From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,fe0d58e5e40e10c7 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed.freenet.de!news-lei1.dfn.de!news.uni-jena.de!not-for-mail From: Christopher Broeg Newsgroups: comp.lang.ada Subject: Re: many exceptions cause memory leak? Date: Tue, 25 Oct 2005 16:09:03 +0200 Organization: Friedrich Schiller University Jena, Germany Message-ID: References: NNTP-Posting-Host: ent.astro.uni-jena.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: lc03.rz.uni-jena.de 1130249343 17943 141.35.25.76 (25 Oct 2005 14:09:03 GMT) X-Complaints-To: abuse@uni-jena.de NNTP-Posting-Date: Tue, 25 Oct 2005 14:09:03 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050921 X-Accept-Language: en-us, en In-Reply-To: Xref: g2news1.google.com comp.lang.ada:5924 Date: 2005-10-25T16:09:03+02:00 List-Id: 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 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