From: "Alex Xela" <xela2@free.fr>
Subject: Re: using 'storage_size ?
Date: Mon, 13 Oct 2003 20:20:34 +0200
Date: 2003-10-13T20:20:05+02:00 [thread overview]
Message-ID: <3f8aecd5$0$13291$626a54ce@news.free.fr> (raw)
In-Reply-To: 3F89E26E.40705@comcast.net
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2299 bytes --]
-------------
Yes, but the gnat strategy should not matter with the fact that when I
define a pool of 8 Mo, I should be able to allocate at least 5Mo.
Alex.
-------------
"Robert I. Eachus" <rieachus@comcast.net> a �crit dans le message de news:
3F89E26E.40705@comcast.net...
> Alex Xela wrote:
> >
> > with ada.text_io,Unchecked_Deallocation,Ada.Exceptions;
> > procedure garbage is
> > ko : constant := 1024;
> > Mo : constant := ko*ko;
> ...
> > declare
> > type local_ptr is access tab_byte;
> > for local_ptr'storage_size use Mo*8;--[line 20]GNAT 3.15p raised
> > STORAGE_ERROR : EXCEPTION_STACK_OVERFLOW
>
> Read the fine manual. In this case the gnat_rm will point you to
> System.Pool_Size in s-poosiz.ads which says:
>
> --------------------------------------------------------------------------
---
> ------------------------
> -- Stack_Bounded_Pool --
> ------------------------
>
> -- Allocation strategy:
>
> -- Pool is a regular stack array, no use of malloc
> -- user specified size
> -- Space of pool is globally reclaimed by normal stack management
>
> -- Used in the compiler for access types with 'STORAGE_SIZE rep.
clause
> -- Only used for allocating objects of the same type.
>
> --------------------------------------------------------------------------
--
>
> Translation, when you use 'Storage_Size in GNAT to set the storage for a
> type, the compiler takes that as a directive to allocate a
> local_ptr'storage_size array on the stack, in this case as part of the
> stack frame for the declare block. If you comment the line out, the
> storage designated by local_ptr values will be allocated on the heap
> when new is called.
>
> I suspect that you need to grow the stack size if you want to grab a
> megabyte in one chunk.
>
> --
> 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
>
next prev parent reply other threads:[~2003-10-13 18:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-12 7:37 using 'storage_size ? Alex Xela
2003-10-12 12:34 ` Duncan Sands
2003-10-12 14:12 ` Alex Xela
2003-10-12 18:23 ` Duncan Sands
2003-10-12 23:24 ` Robert I. Eachus
2003-10-13 18:20 ` Alex Xela [this message]
2003-10-13 18:53 ` Robert I. Eachus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox