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-Language: ENGLISH,ASCII X-Google-Thread: 103376,466b8f87784a3756 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-30 00:35:49 PST Path: newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!128.39.3.168!uninett.no!ntnu.no!randhol+abuse From: randhol+abuse@pvv.org (Preben Randhol) Newsgroups: comp.lang.ada Subject: Re: Problems freeing memory with Free Date: Mon, 30 Apr 2001 07:35:48 +0000 (UTC) Organization: Norwegian university of science and technology Message-ID: References: <87vgnn5p3q.fsf@deneb.enyo.de> NNTP-Posting-Host: kiuk0156.chembio.ntnu.no Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: tyfon.itea.ntnu.no 988616148 23404 129.241.83.82 (30 Apr 2001 07:35:48 GMT) X-Complaints-To: usenet@itea.ntnu.no NNTP-Posting-Date: Mon, 30 Apr 2001 07:35:48 +0000 (UTC) User-Agent: slrn/0.9.7.0 (Linux) Xref: newsfeed.google.com comp.lang.ada:7037 Date: 2001-04-30T07:35:48+00:00 List-Id: On 30 Apr 2001 00:16:09 +0200, Florian Weimer wrote: > randhol+abuse@pvv.org (Preben Randhol) writes: > > There's no error. A typical implementation of a storage pool > retrieves memory in large chunks from the operating systems and > allocates several objects in each chunk. When the objects are freed, > a chunk can only be returned to the operating system if all objects > which had been allocated in it before have been freed (unless you've > got a compacting garbage collector, but that's another story). I see. So that explaines why if I delete X of the last nodes it frees the memory, while if I free the X first or X in the middle, it may be 50_000 nodes or more the size has no influence apparently, it is not freed as the OS thinks I still need the memory because the last node is still using the memory at a much higher position? The reason why I thought there was an error was that if I excange the Data_Type with a record I have: type Wordgroup_type is record Word : Unbounded_String := To_Unbounded_String(""); Explanation : Unbounded_String := To_Unbounded_String(""); end record; and use this in the same way as the integer in the testing program I put up on the web, then the program start apparently to leak memory if I delete X nodes and then add X nodes again. The size of the memory goes perhaps from: 8Mb -> 8Mb (after freeing I don't see a reduction in memory size) -> 12Mb (some increase, but not as high as 16Mb) or something like this, this does not happen if I use Bounded_String. The problem with Bounded_String however is that the memory consumption is 27Mb, well not in a real situation, but for my testing now :-) I don't use New Wordgroup_type, nor an access type, do I need to to that and set the generic Data_Type to Worgroup_Access_type instead and then use Free on the Wordgroup as well? > I think we discussed this phenomenon just a few months ago. Ah, I'll dig back in my archive... Thanks! -- Preben Randhol ------------------- http://www.pvv.org/~randhol/ -- �For me, Ada95 puts back the joy in programming.�