comp.lang.ada
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
Subject: Re: Problems freeing memory with Free
Date: 01 May 2001 14:30:07 +0200
Date: 2001-05-01T14:30:07+02:00	[thread overview]
Message-ID: <87lmohi75c.fsf@deneb.enyo.de> (raw)
In-Reply-To: slrn9eq5ht.13j.randhol+abuse@kiuk0156.chembio.ntnu.no

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.



      parent reply	other threads:[~2001-05-01 12:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-29 20:29 Problems freeing memory with Free Preben Randhol
2001-04-29 22:16 ` Florian Weimer
2001-04-30  7:35   ` Preben Randhol
2001-04-30  8:01     ` Preben Randhol
2001-04-30 13:23     ` Larry Kilgallen
2001-05-01 12:30     ` Florian Weimer [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox