Re: [fpc-devel] removed MaxAvail,MemAvail,HeapSize

2005-05-24 Thread Hans-Peter Diettrich
Konstantin Münning wrote: 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 as I must have the BP7 compatibility which is very good in 1.0.10. IMO we have two

Re: [fpc-devel] removed MaxAvail,MemAvail,HeapSize

2005-05-24 Thread Marco van de Voort
This means that such code *must* be changed (conditionalized...) before it can be compiled for other platforms. Such a change can be enforced when the legacy API only is implemented for DOS compatible target platforms, inavailable on other platforms. But this doesn't mean that the API is

Re: [fpc-devel] removed MaxAvail,MemAvail,HeapSize

2005-05-24 Thread Florian Klaempfl
Hans-Peter Diettrich wrote: the API is completely removed, it should exist and behave as before, on the platforms to which it applies. It doesn't apply unconditionally to any current fpc target. Even go32v2 might run on windows with changing memory availabilities.

Re: [fpc-devel] removed MaxAvail,MemAvail,HeapSize

2005-05-23 Thread Florian Klaempfl
Konstantin Münning wrote: And in all cases, the program will still crash occasionally because it runs out of memory in certain cases, because the check and the allocation do not happen atomically. You can't put something into the standard Run Time Library which works most of the time, except

Re: [fpc-devel] removed MaxAvail,MemAvail,HeapSize

2005-05-23 Thread Micha Nelissen
On Mon, 23 May 2005 02:29:48 +0200 Konstantin Münning [EMAIL PROTECTED] wrote: But when there is no memory left and you need some you can't behave perfect. Please let it be the programmers choice what to do and how to handle this. It is. Exceptions, ReturnNil, ... A compiler should be

Re: [fpc-devel] removed MaxAvail,MemAvail,HeapSize

2005-05-23 Thread Konstantin Münning
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;

Re: [fpc-devel] removed MaxAvail,MemAvail,HeapSize

2005-05-23 Thread Konstantin Münning
Hi Micha! Thanks for the amusing comments :-). Let me add some of mine. Micha Nelissen wrote: On Mon, 23 May 2005 02:29:48 +0200 Konstantin Münning [EMAIL PROTECTED] wrote: But when there is no memory left and you need some you can't behave perfect. Please let it be the programmers choice

Re: [fpc-devel] removed MaxAvail,MemAvail,HeapSize

2005-05-23 Thread Konstantin Münning
Jonas Maebe wrote: On 23 mei 2005, at 02:29, Konstantin Münning wrote: What would you suggest to return under an OS like Windows, Mac OS X or Linux? The current free memory of the OS? Free memory + buffer cache - minimal buffer cache size enforced by the OS? The previous + available swap

Re: [fpc-devel] removed MaxAvail,MemAvail,HeapSize

2005-05-23 Thread Marco van de Voort
Environment changes sometimes you know! Thus, so does the RTL. There are new means now. New means are good. I'm happy with this. But the removal of some basics which is not really enforced by the environment is what makes me unhappy. If it can't be implemented sanely, it is not a

Re: [fpc-devel] removed MaxAvail,MemAvail,HeapSize

2005-05-23 Thread Jonas Maebe
On 23 mei 2005, at 11:09, Konstantin Münning wrote: The only way to know that is to perform getmem's with every increasing values until one fails. I was not implying that a getmem(maxavail) must work under any circumstances on a multitasking OS. But as the OS knows at a given point what

Re: [fpc-devel] removed MaxAvail,MemAvail,HeapSize

2005-05-23 Thread Peter Vreman
{$ifdef fpc}const memavail=high(ptrint);maxavail=high(ptrint);{$endif} ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel

Re: [fpc-devel] removed MaxAvail,MemAvail,HeapSize

2005-05-23 Thread Marco van de Voort
{$ifdef fpc}const memavail=high(ptrint);maxavail=high(ptrint);{$endif} That's a nice one :-) ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel

Re: [fpc-devel] removed MaxAvail,MemAvail,HeapSize

2005-05-23 Thread Jonas Maebe
On 23 mei 2005, at 11:43, Peter Vreman wrote: {$ifdef fpc}const memavail=high(ptrint);maxavail=high(ptrint);{$endif} Then we could maybe also add an optimization that checks whether you are comparing against the upper or the lower bound of the current type and completely optimize away the

Re: [fpc-devel] removed MaxAvail,MemAvail,HeapSize

2005-05-23 Thread Daniël Mantione
Op Mon, 23 May 2005, schreef Jonas Maebe: On 23 mei 2005, at 11:43, Peter Vreman wrote: {$ifdef fpc}const memavail=high(ptrint);maxavail=high(ptrint);{$endif} Then we could maybe also add an optimization that checks whether you are comparing against the upper or the lower bound of the

[fpc-devel] removed MaxAvail,MemAvail,HeapSize

2005-05-22 Thread Konstantin Münning
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

Re: [fpc-devel] removed MaxAvail,MemAvail,HeapSize

2005-05-22 Thread Konstantin Münning
Florian Klaempfl wrote: 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

Re: [fpc-devel] removed MaxAvail,MemAvail,HeapSize

2005-05-22 Thread Florian Klaempfl
Konstantin Münning wrote: Florian Klaempfl wrote: 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

Re: [fpc-devel] removed MaxAvail,MemAvail,HeapSize

2005-05-22 Thread Jonas Maebe
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,

Re: [fpc-devel] removed MaxAvail,MemAvail,HeapSize

2005-05-22 Thread Jonas Maebe
On 23 May 2005, at 00:56, Konstantin Münning wrote: 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

Re: [fpc-devel] removed MaxAvail,MemAvail,HeapSize

2005-05-22 Thread Konstantin Münning
Jonas Maebe wrote: On 23 May 2005, at 00:56, Konstantin Münning wrote: 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