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-7-bit X-Google-Thread: 103376,466b8f87784a3756 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-05-01 05:41:24 PST Path: newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.icl.net!newsfeed.germany.net!newsfeed2.easynews.net!easynews.net!news.cid.net!news.enyo.de!news1.enyo.de!not-for-mail From: Florian Weimer Newsgroups: comp.lang.ada Subject: Re: Problems freeing memory with Free Date: 01 May 2001 14:30:07 +0200 Organization: Enyo's not your organization Message-ID: <87lmohi75c.fsf@deneb.enyo.de> References: <87vgnn5p3q.fsf@deneb.enyo.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Xref: newsfeed.google.com comp.lang.ada:7066 Date: 2001-05-01T14:30:07+02:00 List-Id: randhol+abuse@pvv.org (Preben Randhol) writes: > 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? This is the situation with more conventional allocator implementations, yes. > 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. Strange. However, if you create an Unbounded_String object, at least GNAT invokes an allocated internally, and heap fragmentation might explain the results you're observing.