comp.lang.ada
 help / color / mirror / Atom feed
From: Joel VanLaven <jvl@ocsystems.com>
Subject: Re: deallocating class-wide objects
Date: 1998/07/07
Date: 1998-07-07T00:00:00+00:00	[thread overview]
Message-ID: <35a235e3.0@news4.his.com> (raw)
In-Reply-To: u7m1qluve.fsf@gsfc.nasa.gov

Stephen Leake <Stephen.Leake@gsfc.nasa.gov> wrote:
: When I run the code below (compiled with GNAT 3.10p, Windows NT 4.0),
: I get the following output (the Test_Storage_Pools package just adds
: debug statments to 'new' and 'free') :

: ./test_allocate.exe 
: allocating   12 from Puppet_Storage_Pool
: deallocating 4 from Puppet_Storage_Pool

: allocating   8 from Puppet_Storage_Pool
: deallocating 4 from Puppet_Storage_Pool

: allocating   12 from Muppet_Storage_Pool
: deallocating 12 from Muppet_Storage_Pool

: The first two cases are wrong; it should deallocate the same amount it
: allocates. It appears that GNAT is deallocating just enough for the
: root type, rather than for the derived type. The third case
: deallocates the derived type directly, and works as expected.

: I can't bring myself to believe that GNAT has a bug this
: basic at this stage in the game. On the other hand, ObjectAda won't
: even compile this code (bug report in the works). Can anyone confirm
: that GNAT is wrong, or am I doing something erroneous?

: -- Stephe.

Well, I haven't spent the time to look at your code much, but I did compile
it with PowerAda (our compiler :) and it behaved as you thought it should
(deallocating the same amount as it allocated).  While annecdotal evidence
isn't a proof it does indicate to me that you are correct and GNAT is in
error.  Note that our compiler is on a PowerPc running AIX but I don't
think that has any bearing on your test case.

-- Joel VanLaven
-- OC Systems




  reply	other threads:[~1998-07-07  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-07-06  0:00 deallocating class-wide objects Stephen Leake
1998-07-07  0:00 ` Joel VanLaven [this message]
1998-07-08  0:00   ` Robert Dewar
1998-07-08  0:00 ` Tucker Taft
replies disabled

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