comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Storage Pools and alloca
Date: 16 Oct 2002 06:20:50 +0100
Date: 2002-10-16T06:20:50+01:00	[thread overview]
Message-ID: <x7vlm4zc631.fsf@pushface.org> (raw)
In-Reply-To: wcczntfikew.fsf@shell01.TheWorld.com

Robert A Duff <bobduff@shell01.TheWorld.com> writes:

> Storage_Size is supposed to return the amount of "reserved" space,
> which in virtual memory systems might be zero.  ('Storage_Size is
> kind of useless, actually.  I've never written a program that
> queried 'Storage_Size.  Has anybody?)

We have used Storage_Size clauses where

  we want to use new/unchecked deallocation rather than managing
  storage reclamation by hand

  we know the maximum number of instances

  we don't want to have lots of malloc/free churn because of rumours
  about its performance

  we don't want to have lots of malloc/free churn because of heap
  fragmentation issues (long-running embedded system, no memory
  management)

As an example, for a maximum on 4 instances,

   type Handle is access Instance;
   for Handle'Storage_Size use Instance'Object_Size / 8 * 4;

(I know see that perhaps I should have used the standard
'Max_Size_In_Storage_Elements rather than the GNAT 'Object_Size. Oh
well, easy to change that sort of thing with a code generator!)


As for querying it, well, I think you may be right ..



      parent reply	other threads:[~2002-10-16  5:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-15 15:42 Storage Pools and alloca Frank J. Lhota
2002-10-15 16:32 ` Matthew Heaney
2002-10-15 17:26   ` Frank J. Lhota
2002-10-15 18:02     ` David C. Hoos
2002-10-15 19:14 ` Robert A Duff
2002-10-15 20:23   ` Frank J. Lhota
2002-10-15 20:54     ` Robert A Duff
2002-10-16 13:42       ` Frank J. Lhota
2002-10-16  7:32     ` Eric G. Miller
2002-10-16 13:42       ` Frank J. Lhota
2002-10-19 20:30         ` Eric G. Miller
2002-10-16  5:20   ` Simon Wright [this message]
replies disabled

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