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-06 06:11:09 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!news.iac.net!news-out.cwix.com!newsfeed.cwix.com!sjc-peer.news.verio.net!news.verio.net!iad-read.news.verio.net.POSTED!kilgallen From: Kilgallen@eisner.decus.org.nospam (Larry Kilgallen) Newsgroups: comp.lang.ada Subject: Re: How do I free unbounded strings? Message-ID: <+2AUoSXZYRsx@eisner.encompasserve.org> References: <3AA3DEC1.24B781CA@home.com> Organization: LJK Software Date: 6 Mar 2001 09:10:59 -0500 NNTP-Posting-Host: 216.44.122.34 X-Complaints-To: abuse@verio.net X-Trace: iad-read.news.verio.net 983887866 216.44.122.34 (Tue, 06 Mar 2001 14:11:06 GMT) NNTP-Posting-Date: Tue, 06 Mar 2001 14:11:06 GMT Xref: supernews.google.com comp.lang.ada:5461 Date: 2001-03-06T09:10:59-05:00 List-Id: In article <3AA3DEC1.24B781CA@home.com>, Mark Biggar writes: > 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. While such a caching strategy can provide significant performance benefits, there are situations where it is done by the "operating system". In VMS that is the LIB$*_VM runtime library calls, which are delivered as part of the operating system although they are not part of the kernel. The same precautions you mention about measuring free memory still apply. Few programs bypass the LIB$*_VM runtime library calls.