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,252335f59f63d4d5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2000-12-13 14:33:18 PST Path: supernews.google.com!sn-xit-02!supernews.com!216.227.56.88.MISMATCH!telocity-west!TELOCITY!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsswitch.lcs.mit.edu!howland.erols.net!newsfeed.mindspring.net.MISMATCH!news.mindspring.net!not-for-mail From: Larry Hazel Newsgroups: comp.lang.ada Subject: Re: pointers and pointers. Date: Wed, 13 Dec 2000 16:33:32 -0600 Organization: MindSpring Enterprises Message-ID: <3A37F93C.2DB9BB8A@mindspring.com> References: <90upch$fio$1@nnrp1.deja.com> <918s98$5d3$1@uranium.btinternet.com> NNTP-Posting-Host: c7.ae.9c.c5 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Server-Date: 13 Dec 2000 22:32:16 GMT X-Mailer: Mozilla 4.76 [en] (Win98; U) X-Accept-Language: en,x-ns11F8K63r3NhQ,x-ns2r2e09OnmPe2 Xref: supernews.google.com comp.lang.ada:3099 Date: 2000-12-13T22:32:16+00:00 List-Id: You can always have an internal linked list of unused, available elements. Then, deallocation consists of placing the element in the list. Whenever you need a new element, get it from the internal list and only allocate a new element when the internal list is empty. Singlespeeder wrote: > > > > > Any text book on Ada will have lots of examples of the use > > of access types. That is where you should look. > > I think you'll find that most text books use the linked list example, but > completely fail to mention how you should deallocate the memory grabbed by > the new operator when you remove the item from the list. I've had lists that > grow to 40MB before I empty them, so I want to be sure that the memory is > being deallocated properly. Do I have to use an unchecked_deallocation to do > this or is there a neater (better) way? > > Any expansion on this vague topic over and above what the text books say > would be gladly received, because quite frankly most of them give rise to > more FAQs than they answer. > > I learnt what I know (which isn't a lot) by looking at the source examples > for the GNAT implementation of the unbounded_strings and generic queue. > > Any explanations in Ada 83 terms rather than Ada 95 would be preferred by > me. > > Nick > singlespeeder@32sixteen.com -- Larry Hazel