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 18:54:03 PST Path: supernews.google.com!sn-xit-03!supernews.com!cyclone-sf.pbi.net!209.81.14.120!feeder.via.net!newshub2.rdc1.sfba.home.com!news.home.com!news1.frmt1.sfba.home.com.POSTED!not-for-mail Message-ID: <3AA3DEC1.24B781CA@home.com> From: Mark Biggar X-Mailer: Mozilla 4.76 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: How do I free unbounded strings? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Tue, 06 Mar 2001 02:52:16 GMT NNTP-Posting-Host: 65.3.211.243 X-Complaints-To: abuse@home.net X-Trace: news1.frmt1.sfba.home.com 983847136 65.3.211.243 (Mon, 05 Mar 2001 18:52:16 PST) NNTP-Posting-Date: Mon, 05 Mar 2001 18:52:16 PST Organization: Excite@Home - The Leader in Broadband http://home.com/faster Xref: supernews.google.com comp.lang.ada:5451 Date: 2001-03-06T02:52:16+00:00 List-Id: Erik Sigra wrote: > For unbounded strings the ":=" operation does the necessary storage > management through Adjust and Finalize operations to allocate needed space > for the new value of the target and to reclaim the space previously > occupied by the object. > ...example program deleted. > So it appears to me as if freeing doesn't work as the rationale says. Could > someone please help me with this? Sure, first you must understand that there is a difference between freeing memory for a data structure in a program and a program actually giving back memory to the operating system. On most operating systems when a program needs more memory it asks the Opsys for a large block and then allocated chunks of that block to various dymanmic data stuctures (like Unbounded_String), but when the program frees one of those data structures, it is only part fo the large block and so is not given back to the Opsys, it just becomes available to be allocated for some other data structure in that program. In fact, most programs never given back the large blocks until the program finishes execution. So that mean that the memory allocate display you used likely only shows the high water mark for memory allocation for your program. Now what the rational was talking about that when you free a data structure (like an Unbounded_String) that memory become available for reallocation in the current program. -- Mark Biggar mark.biggar@trustedsyslabs.com