comp.lang.ada
 help / color / mirror / Atom feed
* Re: pointers and pointers.
       [not found] ` <90upch$fio$1@nnrp1.deja.com>
@ 2000-12-13 22:16   ` Singlespeeder
  2000-12-13 22:33     ` Larry Hazel
  0 siblings, 1 reply; 2+ messages in thread
From: Singlespeeder @ 2000-12-13 22:16 UTC (permalink / raw)


>
> 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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: pointers and pointers.
  2000-12-13 22:16   ` pointers and pointers Singlespeeder
@ 2000-12-13 22:33     ` Larry Hazel
  0 siblings, 0 replies; 2+ messages in thread
From: Larry Hazel @ 2000-12-13 22:33 UTC (permalink / raw)


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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-12-13 22:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox