comp.lang.ada
 help / color / mirror / Atom feed
From: Larry Hazel <lhazel@mindspring.com>
Subject: Re: pointers and pointers.
Date: Wed, 13 Dec 2000 16:33:32 -0600
Date: 2000-12-13T22:32:16+00:00	[thread overview]
Message-ID: <3A37F93C.2DB9BB8A@mindspring.com> (raw)
In-Reply-To: 918s98$5d3$1@uranium.btinternet.com

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



      reply	other threads:[~2000-12-13 22:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <RpzY5.66660$2A2.2943791@news20.bellglobal.com>
     [not found] ` <90upch$fio$1@nnrp1.deja.com>
2000-12-13 22:16   ` pointers and pointers Singlespeeder
2000-12-13 22:33     ` Larry Hazel [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox