[fpc-pascal] FPC Heap Management : sub-allocation ?

Michael Van Canneyt michael at freepascal.org
Sat Nov 1 09:44:34 CET 2014

On Fri, 31 Oct 2014, Brian wrote:

> Frederic Da Vitoria wrote
>> I think that Brian is asking if a memory leak could eat the system's
>> memory
>> irreversibly. IIUC in Windows, when the program is stopped, all it's
>> memory
>> is freed, even if the program leaked memory. I don't know about Linux, but
>> I'd be surprised if it weren't the same.
>> -- 
>> Frederic Da Vitoria
>> (davitof)
>> Membre de l'April - « promouvoir et défendre le logiciel libre » -
>> http://www.april.org
>> _______________________________________________
>> fpc-pascal maillist  - 
>> fpc-pascal at .freepascal
>> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
> Yes that is exactly what I was asking. For a high reliable system running
> 24/7 my fear using Object Oriented code vs procedural code is exactly what
> you mentioned . If there is a serious leak , or even a small one for an
> extended period of time , it can take down the OS. I have seen this happen
> with Sun OS and a 3rd party driver that leaked and caused the OS to crash
> after an extended period of time.

First, Linux will simply kill off processes if memory is exhausted, to ensure system stability.

Second: a driver is something special. Most drivers run in kernel (OS) space.
If the kernel itself leaks memory, obviously it can not kill itself...

Third: on unix, you can tell the system how much memory a program is 
allowed to consume. If the program tries to consume more, it will simply 
not receive it. See the getrlimit/setrlimit calls.

So for a user-space program there really is nothing to worry about.


More information about the fpc-pascal mailing list