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=-2.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,2a9b16f914dd588 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-05 13:14:02 PST Path: supernews.google.com!sn-xit-03!supernews.com!freenix!enst!enst.fr!not-for-mail From: Erik Sigra Newsgroups: comp.lang.ada Subject: Re: How do I free unbounded strings? Date: Mon, 5 Mar 2001 22:10:21 +0100 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: References: <87wva43rdp.fsf@deneb.enyo.de> Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Trace: avanie.enst.fr 983826725 52654 137.194.161.2 (5 Mar 2001 21:12:05 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Mon, 5 Mar 2001 21:12:05 +0000 (UTC) To: comp.lang.ada@ada.eu.org Return-Path: X-Mailer: KMail [version 1.2] In-Reply-To: <87wva43rdp.fsf@deneb.enyo.de> Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0 Precedence: bulk X-Reply-To: sigra@home.se List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , List-Archive: Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: supernews.google.com comp.lang.ada:5443 Date: 2001-03-05T22:10:21+01:00 m�ndagen den 5 mars 2001 21:14 skrev Florian Weimer: > 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. Thanks. Then I will assume that things are allright. Now to a related question. Consider this situation: type Post_Node; type Post_List is access Post_Node; type Post_Node is record Name : Unbounded_string; Next : Post_List; end record; I allocate a Post_Node and store an unbounded string in it. Then I deallocate it with an instance of Ada.Unchecked_Deallocation. Is the memory that the unbounded string used lost? If so, does it help to assign Null_Unbounded_String to it before freeing the record? Or is there something else I have to do, some pitfalls? If the answer can be found in some document, can you provide a link?