28 lines
956 B
Plaintext
28 lines
956 B
Plaintext
|
/*
|
||
|
PROGRAM
|
||
|
malloc(), free(), realloc()
|
||
|
AUTHOR
|
||
|
Dick Grune, Free University, Amsterdam
|
||
|
Modified by Ceriel Jacobs, Free University, Amsterdam,
|
||
|
to make it faster
|
||
|
VERSION
|
||
|
$Header$
|
||
|
DESCRIPTION
|
||
|
This is an independent rewrite of the malloc/free package; it is
|
||
|
fast and efficient. Free blocks are kept in doubly linked lists,
|
||
|
list N holding blocks with sizes between 2**N and 2**(N+1)-1.
|
||
|
Consequently neither malloc nor free have to do any searching:
|
||
|
the cost of a call of malloc() (or free()) is constant, however
|
||
|
many blocks you have got.
|
||
|
|
||
|
If you switch on the NON_STANDARD macro (see param.h) every block
|
||
|
costs 2 pointers overhead (otherwise it's 4).
|
||
|
*/
|
||
|
/*
|
||
|
There is an organisational problem here: during devellopment
|
||
|
I want the package divided into modules, which implies external
|
||
|
names for the communication. The only external names I want in
|
||
|
the finished product are malloc, realloc and free. This requires
|
||
|
some hanky-panky.
|
||
|
*/
|