------------- 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" 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 >