peter at freepascal.org
Fri Mar 21 13:09:24 CET 2003
> On Friday 21 March 2003 12:29, you wrote:
>> >> > But, when I use fail in my simple example program, it returns
>> >> NIL okay but
>> >> > the Heaptrace function tells me I have two unfreed memory blocks
>> >> > bytes).
>> >> > I can't see a memory leak anywhere else in that program, what
>> >> could cause
>> >> > this? (Heaptrace output is as follows: I am using FPC 1.0.6 btw)
>> >> [snip heap dump]
>> >> That is the exception frame that is left on the heap. I don't have
>> >> time to analyze what the cause is that the exception frame is not
>> >> removed.
>> > It may be a bug in 1.0.6 which has subsequently been fixed. I
>> > and
>> > installed the 1.1 snapshots and compiled the same source code, and the
>> > memory leak vanishes....
>> The reason why 1.1 has no leak is that it uses the stack to store the
>> exception frames. The real problem is still there, because exception
>> is still not updated
> some months ago i had a discussion with a friend, converning global
> absolute) variables. his point of view was that they're not necessary when
> using oop; mine was, sometimes they're absoulutely necessary.
> if we have just one level of exception processing above normal program
> execution (i. e. while an exception is being processed, no other exception
> will gain control), we can use absolute variables for the exception frame.
> it's even possible to define a fixed whole number of exception layers and
> allocate absolute memory for N exception levels.
> that memory space would not get lost, as it can be saved by allocating the
> 'normal' stack or 'normal' heap more tightly - the old system has to
> exception spae implicitely on the stack or on the heap.
> what do you think about that?
It does not fix the problem, the frame is then still left on the stack.
The allocation on the heap has already been changed to allocation on the
stack in 1.1, because hat is much faster. Using a predefined storage of N
exception levels is adding a limit and that is something we want to
More information about the fpc-pascal