comp.lang.ada
 help / color / mirror / Atom feed
From: Jan Prazak <janp9@gmx.net>
Subject: access / freeing memory
Date: Mon, 15 Jul 2002 23:52:57 -0100
Date: 2002-07-15T23:52:57-01:00	[thread overview]
Message-ID: <pan.2002.07.15.23.51.51.725321.2066@gmx.net> (raw)

Hello,

I have finished reading one Ada tutorial (I won't say that I did
understand everything), but the section about "access" was not very
clearly explained.

Just imagine this simple situation:
I have a single-linked list, with a "head".

head -> 1 -> 2 -> 3 -> null

Is it really possible to say

 head := null; (to delete all elements)

or

 head.next.next := null; (to delete the 3rd element)

or similar things???

This would be a very bad programming technique in Pascal, because this
would create a "memory hole". There each element has to be "disposed" with
a procedure called "Dispose".

The tutorial explains a similar procedure, called Unchecked_Deallocation,
but it's said that it's not recommended to use it (because some other
access type could access that memory address (that's clear)).
So does the operating system take care of the deallocation?
And what about other OSs than Linux? Or has this to do with the Ada
compiler, which maintains the memory (de)allocation? (This would be more
logical.)

Thanks,
Jan




             reply	other threads:[~2002-07-16  0:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-16  0:52 Jan Prazak [this message]
2002-07-15 22:22 ` access / freeing memory tmoran
2002-07-16 13:54   ` Jan Prazak
2002-07-16 11:51     ` Fabien Garcia
2002-07-16 22:59       ` Jan Prazak
2002-07-16 15:42     ` Darren New
2002-07-16 22:59       ` Jan Prazak
2002-07-17  5:22         ` Simon Wright
2002-07-17 21:36           ` Jan Prazak
2002-07-24  0:25       ` David Thompson
2002-07-23  6:15   ` Kevin Cline
2002-07-18 18:22 ` chris.danx
2002-07-19 13:32   ` Jan Prazak
2002-07-19 23:50     ` chris.danx
     [not found] <mailman.1026804243.16337.comp.lang.ada@ada.eu.org>
2002-07-19  1:42 ` Robert A Duff
replies disabled

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