[fpc-devel] removed MaxAvail,MemAvail,HeapSize

Konstantin Münning konstantin at muenning.com
Mon May 23 10:08:50 CEST 2005


Florian Klaempfl wrote:
> Konstantin Münning wrote:
> 
>>By the way, I've found the following code in compiler/cclasses.pas when
>>I searched for the whereabouts of maxavail/memavail and there were some
>>more like this in the sources:
>>
>>{$ifdef HASGETHEAPSTATUS}
>>        status:=GetFPCHeapStatus;
>>        startmem:=status.CurrHeapUsed;
>>{$else HASGETHEAPSTATUS}
>>        startmem:=memavail;
>>{$endif HASGETHEAPSTATUS}
>>
>>I'm not sure if I understand it right as GetHeapStatus is not documented
>>well (I've found no reference for the meaning of the fields of the
>>returned record) but it seems that someone repaced here memavail with
>>another code which does about the same and has therefore the same flaw.
> 
> 
> It has been moved to heap status which contains more info which also reliable on
> multitasking systems.

Yes, I've already found out that there is the GetHeapStatus function but 
  the use here is also not atomic so there is no difference regarding 
the discussed bug. If it is reliable then here's a good information 
source for the "new" MaxAvail :-).

By the way, what's the information provided with GetHeapStatus? I've 
found no description in the docs except the record member names. Or 
where to look for?

>>I would hapily contribute the code for a better MemAvail/MaxAvail
>>function if that's the problem. I would like to be able to use the
>>latest compiler which now I definitely can't 
> 
> 
> See below.
> 
> 
>>as I must have the BP7
>>compatibility which is very good in 1.0.10.
> 
> 
> What about Mark and Release when talking about heap management ;)?

I never had a use for that and as nobody reported them missing...

> A compromise would be a tpascal unit which is loaded only in -So mode.

That's I.M.H.O. a good solution. For the affected units I use -So 
anyway. Can I do this "myself" by some compiler option or must it be 
included in the compiler source? If you tell me how this unit should be 
called I would happily provide it.

Konstantin




More information about the fpc-devel mailing list