Next: , Previous: atof strtod, Up: libnix.a


6.4.4 Memory management

Most of the memory management of this library runs through malloc(). Only the commandline parser uses AllocVec() - so you can use it without having the malloc function somewere in your program.

The memory management uses a local (to this task) memory pool to reduce memory fragmentation. It uses the system functions to do so (not the new pooled memory functions but just the older Allocate(), Deallocate() pair which are the <3.0 fallback for libamiga.a's pooled memory functions, too) so there should be no problems with it - these functions are tested very good.

The default blocksize for memory allocations is 16384 bytes - equivalent to 4 MMU pages. Bigger allocations are blown up to a multiple of 4096 bytes. So don't be alarmed if your program uses more memory then expected.

If you don't like this value (if you use bigger portions frequently or only use very little memory) you can replace it by declaring

unsigned long _MSTEP

You should use a multiple of MMU pages. If you don't use a full MMU page you gain nothing - malloc rounds up anyway.