comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Storage management
Date: Sat, 01 Nov 2008 18:28:04 -0400
Date: 2008-11-01T18:28:04-04:00	[thread overview]
Message-ID: <wccej1vw07f.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 87fxmbog1u.fsf@mid.deneb.enyo.de

Florian Weimer <fw@deneb.enyo.de> writes:

> What is the current state of the art with regard to programmer support
> for storage management?
>
> With GNAT, Ada.Finalization adds tons of run-time calls to deal with
> abort deferral (even with pragma Restrictions (No_Abort_Statements)),
> puts the object on some sort of list, and does some secondary stack
> allocations which I don't understand.  Clearly, this is not supposed
> to be used in performance-critical code, so I doubt it can be used for
> a generic smart pointer implementation.  (Object allocation in inner
> loops is generally a bad idea, but this overhead is also incurred when
> copying smart pointers around.)

AdaCore is actively working on making finalization much more efficient
(e.g. avoiding all those finalization lists, when possible).

> Is there some other approach?  Can limited types be used to enforce
> linearity (in the sense of linear types, cf.
> <http://home.pipeline.com/~hbaker1/Use1Var.html> and
> <http://iml.univ-mrs.fr/~girard/linear.pdf>)?

Yes, you can do better with limited types (derive from
Limited_Controlled instead of Controlled).

> If it's about pure storage management, GC support would be an option,
> too, but AFAIK, you need one of the managed code implementations for
> that, or somewhat unsafe libraries (in the sense that you need to
> specify which objects are leaf objects, and only store access values
> in locations where they are visible to the collector).

There is some intention to support proper GC at AdaCore, but it's going
to be rather far in the future -- not a whole lot of (paying) customer
demand for that.  Meanwhile, you can try the Boehm "conservative" GC.
My experience is that it works pretty well, so long as you don't use up
most of your address space with allocated objects.  So on a 64-bit
machine, that should work pretty well.  Or on a 32-bit machine, if you
don't use too much real memory.

The ARG is also working on some interesting "region based" schemes.

- Bob



  reply	other threads:[~2008-11-01 22:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-01 11:13 Storage management Florian Weimer
2008-11-01 22:28 ` Robert A Duff [this message]
2008-11-02 14:27   ` Florian Weimer
2008-11-07  1:14     ` Randy Brukardt
2008-11-07  8:30       ` Dmitry A. Kazakov
2008-11-07  9:54         ` Niklas Holsti
2008-11-07  9:20           ` Dmitry A. Kazakov
2008-11-07 12:12             ` Niklas Holsti
2008-11-07 13:22               ` Dmitry A. Kazakov
2008-11-07 13:28                 ` Georg Bauhaus
2008-11-07 14:41                   ` Dmitry A. Kazakov
2008-11-10 14:28                 ` christoph.grein
2008-11-10 16:08                   ` Dmitry A. Kazakov
2008-11-08 11:04         ` sjw
2008-11-08 12:33           ` Dmitry A. Kazakov
2008-11-10  9:34             ` sjw
2008-11-01 22:36 ` sjw
replies disabled

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