comp.lang.ada
 help / color / mirror / Atom feed
From: Christopher Broeg <broeg@astro.uni-jena.de>
Subject: Re: many exceptions cause memory leak?
Date: Tue, 25 Oct 2005 16:09:03 +0200
Date: 2005-10-25T16:09:03+02:00	[thread overview]
Message-ID: <djle9v$hgn$1@lc03.rz.uni-jena.de> (raw)
In-Reply-To: <q8q7f.4346$c%.822@trndny02>

Frank J. Lhota wrote:
> Do you ever call the following function from the Ada.Exceptions package?
> 
>    function Save_Occurrence
>      (Source : Exception_Occurrence)
>       return   Exception_Occurrence_Access;
> 
> This function allocates an Exception Occurrence from the heap and copies 
> the data from Source into this new occurrence. It is up to the 
> programmer to deallocate the result of this function. An instance of 
> Unchecked_Conversion can be used for this purpose.
> 
> Failure to deallocate the results of the Save_Occurrence function would 
> certainly result in a memory leak.
> 
> Also, is there any other Ada.Exceptions subprogram that you call? More 
> info on how you are using exceptions might help us diagnose the problem.
> 

Hi,

no I do not use save_occurence. I do use Raise_Exception and 
exception_information / message, though.

I am still running the code and it seems that the major memory leak 
problem is solved:

Global information
------------------
    Total number of allocations        :4216666
    Total number of deallocations      :3823682
    Final Water Mark (non freed mem)   :  32.21 Megabytes
    High Water Mark                    :  32.26 Megabytes

However, it appears strange to me that gnatmem detects so many non freed 
allocations originating in the exception package:

Allocation Root # 1
-------------------
  Number of non freed allocations    :392937
  Final Water Mark (non freed mem)   :   2.44 Megabytes
  High Water Mark                    :   2.44 Megabytes
  Backtrace                          :
    a-except.adb:1396 <ada__exceptions___elabb>

  Of course, the program is still running, but in the past those 
occurences have not been freed upon termination. The memory use of 2.44 
MB fits well with the fact that the code started out with a high water 
mark of roughly 29 MB and during the day raised the value to 32.21 MB. 
To be clear, this poses no problem at all to me, now. I am just curious 
and would like to understand what is going on.

I thank you all for the helpful comments and suggestions.

Chris



  reply	other threads:[~2005-10-25 14:09 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
2005-10-26 10:56           ` Christopher Broeg
2005-10-25 13:09       ` Frank J. Lhota
2005-10-25 14:09         ` Christopher Broeg [this message]
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