[fpc-devel] removed MaxAvail,MemAvail,HeapSize

Florian Klaempfl F.Klaempfl at gmx.de
Sun May 22 19:17:29 CEST 2005


Konstantin Münning wrote:

> Hi everybody!
> 
> Why in fact were MaxAvail,MemAvail,HeapSize removed from the RTL? The
> explanation in install/doc/whatsnew.txt is puzzling me a bit:
> 
>   - Removed MaxAvail, MemAvail, HeapSize due to their unreliability
>     (bogus/misleading return values) in multitasking environment with
> swapping
> 
> Is the incompatibility of the source code preferred over a misleading
> result? 

In this case, yes. Better fail totally than under rare circumstance and
hard to reproduce because the crashes are caused by a lack of memory
causing strange behaviour of memavail in combination with new/getmem.

Keep in mind that the code
if maxavail>=10000 then
  getmem(p,10000);
is completly useless in any multitasking environment.

> Such a major change should have a bit better explanation. I just
> checked the FPC introduction that there is still the claim for
> "excellent compatibility with TP 7.0" which seems I.M.H.O. now to be broken.

How should work MaxAvail/MemAvail in a multitasking environment to be TP
compatible?

> 
> I understand that this may lead to strange behaviour of a program but
> wouldn't it have been better to include a remark in the documentation
> than to remove the function(s)? So it would be programmer's choice to
> leave it or to change it to something appropriate for the environment of
> the program.
> 
> So, what are now the options? What are the recommended replacements for
> these functions? What's the best way to make working programs to compile
> again?
> 
> By the way, there are still references in the RTL, the examples and the
> docs to these now missing functions. Some seem to have been missed on
> cleaning ;-).
> 
> Have a nice day,





More information about the fpc-devel mailing list