comp.lang.ada
 help / color / mirror / Atom feed
* GNAT: storage error and tasks
@ 2000-01-26  0:00 pjbrooke
  2000-01-26  0:00 ` Ted Dennison
  2000-01-26  0:00 ` Aidan Skinner
  0 siblings, 2 replies; 5+ messages in thread
From: pjbrooke @ 2000-01-26  0:00 UTC (permalink / raw)


Hi,

I have a program that naturally decomposes into a procedure plus three
tasks.  Each task contains some 'large' data structures.

If I rewrite the program to use packages instead of tasks (this makes
other bits rather messy, so I'd rather use tasks) then there is no
problem.  However, when using tasks, they raise Storage_Error.

I'm using GNAT 3.10p on a Debian Linux machine.

I'm sure I'm missing something here (I've tried looking through the GNAT
documentation, the LRM, Deja...), but I'm not getting very far with it.
Can anyone tell me what I've forgotten/done wrong?

Thanks,

Phil.


Sent via Deja.com http://www.deja.com/
Before you buy.




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

* Re: GNAT: storage error and tasks
  2000-01-26  0:00 GNAT: storage error and tasks pjbrooke
@ 2000-01-26  0:00 ` Ted Dennison
  2000-02-05  0:00   ` Robert Dewar
  2000-01-26  0:00 ` Aidan Skinner
  1 sibling, 1 reply; 5+ messages in thread
From: Ted Dennison @ 2000-01-26  0:00 UTC (permalink / raw)


In article <86mjv3$24b$1@nnrp1.deja.com>,
  pjbrooke@my-deja.com wrote:

> I have a program that naturally decomposes into a procedure plus three
> tasks.  Each task contains some 'large' data structures.
>
> If I rewrite the program to use packages instead of tasks (this makes
> other bits rather messy, so I'd rather use tasks) then there is no
> problem.  However, when using tasks, they raise Storage_Error.

Nothing particularly "wrong". Its just that your tasks are probably
running out of stack space. When they are created they each get their
own stack, which is typically sized based on the compiler writer's guess
as to how much most users will ever need. Your compiler docs should
say somewhere what the default is. But its not at all uncommon for tasks
that contain large data structures to blow past that default stack size.

The way to get around this problem is to create a task type for
your task, and perform a
   for My_Task_Type'Storage_Size use XXXXXX;

Where "My_Task_Type" is the name of your task type and XXXXXX is the
number of storage elements (bytes) you need your task to have. As for
dertermining the value of XXXXXX, I generally just double it until the
Storage_Error goes away, then double it again just to be safe.

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com http://www.deja.com/
Before you buy.




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

* Re: GNAT: storage error and tasks
  2000-01-26  0:00 GNAT: storage error and tasks pjbrooke
  2000-01-26  0:00 ` Ted Dennison
@ 2000-01-26  0:00 ` Aidan Skinner
  2000-01-27  0:00   ` pjbrooke
  1 sibling, 1 reply; 5+ messages in thread
From: Aidan Skinner @ 2000-01-26  0:00 UTC (permalink / raw)


On Wed, 26 Jan 2000 10:57:39 GMT, pjbrooke@my-deja.com
<pjbrooke@my-deja.com> wrote: 

>other bits rather messy, so I'd rather use tasks) then there is no
>problem.  However, when using tasks, they raise Storage_Error.
>
>I'm using GNAT 3.10p on a Debian Linux machine.

Two things: 
    1) you probably want to upgrade to gnat 3.12p (try
    http://www.gnuada.org or point apt at the frozen branch), this
    probably won't fix your problem but its a good general idea.

    2) It *sounds* like your doing a lot of stuff on the stack, which
       has a 2MB limit. Try moving stuff onto the heap (by using
       access types).

Or follow ted's sugestion.

- Aidan

-- 
Little Willy was a chemist, Little Willy is no more,
What he thought was H2O, Was H2SO4.
http://www.skinner.demon.co.uk/aidan/




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

* Re: GNAT: storage error and tasks
  2000-01-26  0:00 ` Aidan Skinner
@ 2000-01-27  0:00   ` pjbrooke
  0 siblings, 0 replies; 5+ messages in thread
From: pjbrooke @ 2000-01-27  0:00 UTC (permalink / raw)



> >However, when using tasks, they raise Storage_Error.
> >
> >I'm using GNAT 3.10p on a Debian Linux machine.
> Two things:
> [snip]

Many thanks for the suggestions, both posted and emailed.

I've now got the problem sorted.

Cheers,

Phil.


Sent via Deja.com http://www.deja.com/
Before you buy.




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

* Re: GNAT: storage error and tasks
  2000-01-26  0:00 ` Ted Dennison
@ 2000-02-05  0:00   ` Robert Dewar
  0 siblings, 0 replies; 5+ messages in thread
From: Robert Dewar @ 2000-02-05  0:00 UTC (permalink / raw)


In article <86n1ae$bc8$1@nnrp1.deja.com>,
  Ted Dennison <dennison@telepath.com> wrote:
> The way to get around this problem is to create a task type
> for your task, and perform a
>    for My_Task_Type'Storage_Size use XXXXXX;

This is improper advice, since the feature referenced above
is in annex J, which means that there is a preferred way of
doing things. Never recommend the use of Annex J features
for new code!

use the Storage_Size pragma instead, since it is far more
flexible (allowing different instances of a task type to
have different sizes, something that is impossible with the
obsolete form).


Sent via Deja.com http://www.deja.com/
Before you buy.




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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-26  0:00 GNAT: storage error and tasks pjbrooke
2000-01-26  0:00 ` Ted Dennison
2000-02-05  0:00   ` Robert Dewar
2000-01-26  0:00 ` Aidan Skinner
2000-01-27  0:00   ` pjbrooke

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