comp.lang.ada
 help / color / mirror / Atom feed
From: "Wiljan Derks" <Wiljan.Derks@zonnet.nl>
Subject: Re: many exceptions cause memory leak?
Date: Tue, 25 Oct 2005 20:50:21 +0200
Date: 2005-10-25T20:50:21+02:00	[thread overview]
Message-ID: <369da$435e7da8$3ea6010b$8607@news.versatel.net> (raw)
In-Reply-To: djknki$cl6$1@lc03.rz.uni-jena.de


"Christopher Broeg" <broeg@astro.uni-jena.de> wrote in message 
news:djknki$cl6$1@lc03.rz.uni-jena.de...
>> Global information
>> ------------------
>>    Total number of allocations        :109993
>>    Total number of deallocations      :97243
>>    Final Water Mark (non freed mem)   :  29.85 Megabytes
>>    High Water Mark                    :  29.90 Megabytes
Still looks like you are loosing memory.
Maybe a good tip:
When and exception occurs one can easily asume that an inout variable of a 
procedure
alsready has the value assigned to its end location. Thus something like 
this:
procedure zzz(x: in out access y) is
begin
    x:=new ...
   exception here
end;
When an exception occurs, one could assume that the new pointer is already 
assigned
to the structure that was passed to zzz.
That is however not the case when using gnat.
Typically, the inout parameter is a local variable for the procedure that is 
stored on its final location when doing
a normal procedure exit.
This is a typical reason for loosing memory when doing exception processing.
Changing the mode from inout to and access parameter fixes that.





  parent reply	other threads:[~2005-10-25 18:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-21 10:07 many exceptions cause memory leak? Christopher Broeg
2005-10-21 15:38 ` Frank J. Lhota
2005-10-21 17:59   ` Robert Klungle
2005-10-21 18:13     ` Ed Falis
2005-10-24 11:29 ` Christopher Broeg
2005-10-24 20:00   ` Simon Wright
2005-10-25  7:32     ` Christopher Broeg
2005-10-25  7:42       ` Christopher Broeg
2005-10-25 12:34         ` Alex R. Mosteo
2005-10-25 12:55           ` Alex R. Mosteo
2005-10-25 18:50         ` Wiljan Derks [this message]
2005-10-26 10:56           ` Christopher Broeg
2005-10-25 13:09       ` Frank J. Lhota
2005-10-25 14:09         ` Christopher Broeg
2005-10-24 21:27   ` Andreas Schulz
2005-10-26 12:45 ` Christopher Broeg
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox