From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Chunks of finalized
Date: 1997/10/04
Date: 1997-10-04T00:00:00+00:00 [thread overview]
Message-ID: <EHJ3F6.JA0@world.std.com> (raw)
In-Reply-To: 3434F45A.37ED@gsfc.nasa.gov
In article <3434F45A.37ED@gsfc.nasa.gov>,
Stephen Leake <Stephen.Leake@gsfc.nasa.gov> wrote:
>Do you want to call Finalize on the elements that have been Popped? =
That's presumably the issue. These elements might be hanging on to some
expensive resource, and he wants to free that resource as soon as
possible -- not waiting for a whole chunk to be deallocated.
>... Another way is to assign another object to the
>stack slot, which will be done by the next Push.
Aha! Thank you.
Why wait until the next Push (which might be a long time, or never)?
Inside the generic, you could declare:
type Stack_Element_Holder(Present: Boolean := False) is
record
case Present is
when False => null;
when True => The_Element: Stack_Element_Type;
end case;
end record;
And then build the stack out of arrays of these things. Then, whenever
you Pop, assign a "Stack_Element_Holder'(Present => False)" into the
vacated slot. I think this achieves what the original poster wanted --
it will call Finalize on The_Element (if its controlled), and it will
also call Finalize on all controlled subcomponents of The_Element. And
there's no need to pass in an extra finalization operation, nor to
handle subcomponents by hand. It costs an extra Boolean component for
every stack element, though.
- Bob
next prev parent reply other threads:[~1997-10-04 0:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-10-03 0:00 Chunks of finalized Richard A. O'Keefe
1997-10-03 0:00 ` Stephen Leake
1997-10-04 0:00 ` Robert A Duff [this message]
1997-10-06 0:00 ` Tucker Taft
1997-10-07 0:00 ` Richard A. O'Keefe
1997-10-03 0:00 ` Robert A Duff
1997-10-05 0:00 ` Matthew Heaney
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox