[fpc-pascal]Issues regarding available memory

Jonas Maebe jonas at zeus.ugent.be
Fri May 16 23:36:13 CEST 2003


On vrijdag, mei 16, 2003, at 23:30 Europe/Brussels, Alan Mead wrote:

> Ah. I was looking for a nil pointer from GetMem.  But you're saying
> that I never get it because the heap manager never refuses GetMem, it
> just grows the heap or, if it cannot grow the heap, throws an error?

By default, yes. You can set "ReturnNilIfGrowHeapFails" to true (it's a 
typed constant defined in the interface of the system unit which is 
false by default) to get the behaviour you want though (and then you 
don't need all the exception stuff below, I had forgotten about this 
possibility).

> So I only have an abstract understanding of exceptions.  I wrap the
> getmem in a try..except structure?

Yes.

> Do I need to (can I) test for specific error conditions?

Yes, you can look at the type of the exception.

> I seem to get RTE 216 on Linux and 203 on
> Windows.

That's because of the version difference. RTE 216 = general protection 
fault/segmentation fault. The heap manager apparently crashed in 1.0.4 
if it couldn't grow the heap anymore.

> Or, I don't see a memory exception class on page 102 of the
> refenece guide...  Is there a more complete list elsewhere?

I don't know, Michael?

> BTW, is getmem depracated?

No.


Jonas





More information about the fpc-pascal mailing list