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.


Jonas
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to