comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <rieachus@comcast.net>
Subject: Re: 'Valid, subtypes and constraint checking - Thanks
Date: Tue, 30 Sep 2003 21:30:37 GMT
Date: 2003-09-30T21:30:37+00:00	[thread overview]
Message-ID: <3F79F5E5.9090408@comcast.net> (raw)
In-Reply-To: 3F797AD7.4@noplace.com

Marin David Condic wrote:

> Perhaps in practice, most compilers have connected 
> Unchecked_Deallocation to some OS "free" routine. I suppose it is the 
> job of the vendor to document that and the job of the user to check that 
> this is the case. It would just be nice to have the standard guarantee 
> that it does this or at least provide a means to check that the 
> Unchecked_Deallocation actually *did* reclaim the storage. That way, 
> you'd know if you could count on it to do the job you'd expect it to do.

First, let me agree that compilers should try to document what they do 
in this area.  But it is harder than you might think.  For example, what 
if I try to free a task that is not yet terminated?  Perhaps the current 
task that is executing the call to Unchecked_Deallocation.  Right now a 
compiler can refuse to do anything in such a case, and in fact, is 
expected to do nothing.  (It can free SOME of the memory associated with 
the task, but not all.)

Or a different example.  If your compiler does provide a garbage 
collected heap, do you want Free to trump the garbage collector?  (This 
would mean that the only time Free did something was when the object was 
still accessable...ouch!

A better example is probably reference counted storage.  There you want 
   a call to Free to decrement the count by one, and release the storage 
if the count is equal to zero.

Or let's imagine a 64-bit address space on a virtual memory machine. 
There could be a clever implementation of the heap which keeps a list of 
  space that has been freed on pages that are currently non-resident. 
The memory manager could also decide to materialize a new page of memory 
for an allocation instead of paging in a page that has some free space, 
etc.  Reasonable implementation of a heap?  Sure.  Should an Ada 
compiler be allowed to use such a heap on a system that provides it?  Of 
course.
There are other cases, but I think you get the picture.  The reference 
manual is careful not to say too much.  Vendor documentation can and 
should be much more forthcoming.


-- 
                                         Robert I. Eachus

"Quality is the Buddha. Quality is scientific reality. Quality is the 
goal of Art. It remains to work these concepts into a practical, 
down-to-earth context, and for this there is nothing more practical or 
down-to-earth than what I have been talking about all along...the repair 
of an old motorcycle."  -- from Zen and the Art of Motorcycle 
Maintenance by Robert Pirsig




  reply	other threads:[~2003-09-30 21:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-26 11:41 'Valid, subtypes and constraint checking Peter Amey
2003-09-26 13:13 ` Jean-Pierre Rosen
2003-09-26 18:18 ` Jeffrey Carter
2003-09-26 21:48   ` Chad R. Meiners
2003-09-27  1:30 ` Robert I. Eachus
2003-09-29  7:27   ` 'Valid, subtypes and constraint checking - Thanks Peter Amey
2003-09-30  2:58     ` Robert I. Eachus
2003-09-30 12:45       ` Marin David Condic
2003-09-30 21:30         ` Robert I. Eachus [this message]
2003-10-01 12:44           ` Marin David Condic
replies disabled

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