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,2a9b16f914dd588 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-05 12:06:02 PST Path: supernews.google.com!sn-xit-03!supernews.com!freenix!fr.clara.net!heighliner.fr.clara.net!news.tele.dk!193.174.75.178!news-fra1.dfn.de!news-koe1.dfn.de!news-han1.dfn.de!news.fh-hannover.de!news.cid.net!news.enyo.de!news1.enyo.de!not-for-mail From: Florian Weimer Newsgroups: comp.lang.ada Subject: Re: How do I free unbounded strings? Date: 05 Mar 2001 21:14:26 +0100 Organization: Enyo's not your organization Message-ID: <87wva43rdp.fsf@deneb.enyo.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Xref: supernews.google.com comp.lang.ada:5437 Date: 2001-03-05T21:14:26+01:00 List-Id: Erik Sigra writes: > At First Pause the program always uses (880, 880, 776) memory. At Second > Pause the program uses at least (888, 888, 780) memory. If I enter a long > string this can be for example (900, 900, 784). At Third Pause the program > uses exactly as much memory as at Second Pause. > > The memory values are labelled ("Virtual image size of process in Kbytes", > "Resitent set size; Kbytes of program in memory", "Shared memory in Kbytes"). > > So it appears to me as if freeing doesn't work as the rationale says. Could > someone please help me with this? Well, you can't expect that a program will use operating system interfaces to allocate individual, small strings. Usually, memory is obtained from the operating systems in large chunks which are filled with smaller objects, and only large objects are directly allocated via the operating system. GNAT uses the C malloc()/free() memory management interface, which might or might not return deallocated memory to the operating system (of course, a large chunk can only be given back if all the objects in it have been deallocated). GNU/Linux systems feature a malloc()/free() implementation which does return completely unused chunks.