Re: many exceptions cause memory leak?
- From: Christopher Broeg <broeg@xxxxxxxxxxxxxxxxx>
- Date: Tue, 25 Oct 2005 16:09:03 +0200
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 .
- References:
- many exceptions cause memory leak?
- From: Christopher Broeg
- Re: many exceptions cause memory leak?
- From: Christopher Broeg
- Re: many exceptions cause memory leak?
- From: Simon Wright
- Re: many exceptions cause memory leak?
- From: Christopher Broeg
- many exceptions cause memory leak?
- Prev by Date: Adding support for multiple tasks in wxAda
- Next by Date: Re: and visual library once again
- Previous by thread: Re: many exceptions cause memory leak?
- Next by thread: Re: many exceptions cause memory leak?
- Index(es):
Relevant Pages
|