[fpc-pascal]FPC Heap Allocation/Deallocation

Jonas Maebe jonas at zeus.ugent.be
Fri May 16 15:23:05 CEST 2003

On vrijdag, mei 16, 2003, at 15:13 Europe/Brussels, James Mills wrote:

> Does the Heap manager on FPC release memory that's freed or keeps it
> there ? My program loads up flat file databases (obviously bad but...)
> which seems to chew up over 127Mb of ram, but it doesn't seem to be
> released back to the system after reading...

Indeed, it's kept allocated for later reuse by the program.

> I heard somewhere that FPC 1.0.6 doesn't release memory once it's been
> freed ? If so, will future versions release the memory back to the
> system ?

No. The reason is that it's much more efficient for most programs to 
keep the memory allocated (they'll most likely use it again later on) 
and the default heap manager is written to be optimal for the common 
case. If you want other behaviour, you should either directly request 
the memory from the system and release it yourself for that particular 
allocation, or write your own heap manager.


More information about the fpc-pascal mailing list