comp.lang.ada
 help / color / mirror / Atom feed
* Re: GNAT memory allocation
  1996-08-01  0:00 GNAT memory allocation Henry W. Schneiderman
@ 1996-08-01  0:00 ` Laurent Guerby
  1996-08-02  0:00 ` Tucker Taft
  1 sibling, 0 replies; 3+ messages in thread
From: Laurent Guerby @ 1996-08-01  0:00 UTC (permalink / raw)



Henry> I've got a problem allocating memory using the GNAT Ada
Henry> compiler v3.05 on a Sun Sparc 10 w/ Solaris 2.4.  When I
Henry> declare large arrays (on the order of 1 Meg) I get a core dump.
Henry> It seems like the memory for these large arrays is allocated
Henry> from the stack.  

   Since GNAT on Solaris doesn't implement yet stack checking, this
may indeed be a stack overflow. May be you're declaring a big array in
a task or in a subprogram that is called from a task, then the
solution is to use the pragma Storage_Size, RM95-13.3(61-67) to
specify a bigger stack for the task. If you think this is a compiler
bug, send your set of sources andGNAT version information to
report@gnat.com.

Henry> Is there a way force storage of these arrays
Henry> elsewhere in memory where there is more storage space -- maybe
Henry> something equivalent to the "static" statement in c?  Are there
Henry> any pragmas that do this?

   A "static" C maps to a package defined variable, and there's also
dynamic allocation to allocate arrays on the heap (using new).

Henry> Any help would be greatly appreciated!

   Hope this helps,

-- 
Laurent Guerby <guerby@gnat.com>, Team Ada.
   "Use the Source, Luke. The Source will be with you, always (GPL)."




^ permalink raw reply	[flat|nested] 3+ messages in thread

* GNAT memory allocation
@ 1996-08-01  0:00 Henry W. Schneiderman
  1996-08-01  0:00 ` Laurent Guerby
  1996-08-02  0:00 ` Tucker Taft
  0 siblings, 2 replies; 3+ messages in thread
From: Henry W. Schneiderman @ 1996-08-01  0:00 UTC (permalink / raw)
  Cc: hwschne


I've got a problem allocating memory using the GNAT Ada compiler v3.05
on a Sun Sparc 10 w/ Solaris 2.4.   When I declare large arrays (on the
order of 1 Meg) I get a core dump.  It seems like the memory for these
large arrays is allocated from the stack.  Is there a way force storage
of these arrays elsewhere in memory where there is more storage space --
maybe something equivalent to the "static" statement in c?  Are there
any pragmas that do this?

Any help would be greatly appreciated!

-Henry Schneiderman
hwschne@isrc.sandia.gov or hws@cs.cmu.edu




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: GNAT memory allocation
  1996-08-01  0:00 GNAT memory allocation Henry W. Schneiderman
  1996-08-01  0:00 ` Laurent Guerby
@ 1996-08-02  0:00 ` Tucker Taft
  1 sibling, 0 replies; 3+ messages in thread
From: Tucker Taft @ 1996-08-02  0:00 UTC (permalink / raw)



Henry W. Schneiderman (hwschne@isrc.sandia.gov) wrote:
: I've got a problem allocating memory using the GNAT Ada compiler v3.05
: on a Sun Sparc 10 w/ Solaris 2.4.   When I declare large arrays (on the
: order of 1 Meg) I get a core dump.  It seems like the memory for these
: large arrays is allocated from the stack.  Is there a way force storage
: of these arrays elsewhere in memory where there is more storage space --
: maybe something equivalent to the "static" statement in c?  Are there
: any pragmas that do this?

Objects declared inside (only) packages, as opposed to subprograms,
are equivalent to C's "static" -- they are allocated statically
rather than on the stack.  However, this presumes the size of
the array is known at compile-time.  If the size is not known at 
compile-time, the array may still end up on a "secondary" stack, 
or in the "heap," depending on the implementation.

You can also explicitly allocate an array in the heap using "new".

: Any help would be greatly appreciated!

: -Henry Schneiderman
: hwschne@isrc.sandia.gov or hws@cs.cmu.edu

-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
Intermetrics, Inc.  Cambridge, MA  USA




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1996-08-02  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-08-01  0:00 GNAT memory allocation Henry W. Schneiderman
1996-08-01  0:00 ` Laurent Guerby
1996-08-02  0:00 ` Tucker Taft

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