Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2003-05

FPC Heap Allocation/Deallocation

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

James Mills

Hi,

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...

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 ?

cheers
James

Reply by email

Jonas Maebe
to James Mills
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.

Jonas

Reply by email

James Mills
to Jonas Maebe
Jonas Maebe wrote 20 lines
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.

Thanks.

Show quoted text 8 lines
Jonas _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email