[fpc-devel] removed MaxAvail,MemAvail,HeapSize

Jonas Maebe jonas at zeus.ugent.be
Sun May 22 20:28:26 CEST 2005

On 22 May 2005, at 20:07, Konstantin M√ľnning wrote:

>  When you skip the check and allocate always then the program will
> crash anyway when there is not enough memory.

No. Either you catch exceptions resulting from a lack of memory and  
recover, and then you have the same checking as before, except that  
the check happens atomically (by the OS: you ask for more memory and  
if there is no more memory, you get an exception).

Another possibility to set the global system unit variable  
ReturnNilIfGrowHeapFails to true, and then you can check after each  
allocation whether the resulting pointer is nil (if so, not enough  
memory was available) or not.


More information about the fpc-devel mailing list