comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Storage_Size in a Simple Program
Date: Wed, 24 Oct 2018 23:51:08 +0300
Date: 2018-10-24T23:51:08+03:00	[thread overview]
Message-ID: <g3c49gF852mU1@mid.individual.net> (raw)
In-Reply-To: <1nx5k9a.1n8zqjs1xf0pe6N%csampson@inetworld.net>

On 18-10-24 12:07 , Charles H. Sampson wrote:
> Charles H. Sampson <csampson@inetworld.net> wrote:
>
>> I've got a conceptually simple program that uses a lot of memory. It is
>> highly recursive (using a lot of stack) and also puts a lot of stuff on
>> the heap. Is there any way to specify that a lot of memory is needed
>> other than pragma Storage_Size?
>>
>> As it is, I have three totally artificial tasks hidden in packages. The
>> packages' entry routines are simply pass-throughs to their embedded
>> task's entries. There are no concurrency issues because the simple
>> program is single-threaded at heart.
>>
>> Is that it? That's a lot of baggage just to give permission to use more
>> memory, particularly when there's a lot of memory lying around now.
>
> All the responses about limit/ulimit are certainly solutions, but
> they're not quite what I was asking about. I was looking for a solution
> written in Ada. I've been around Ada long enough to remember that a goal
> was to be able to completely express programs in Ada itself without
> having to worry about outside influences. (I write this knowing that the
> semantics of pragma Storage_Size are not at all tight.)

If you need a big stack:

- All Ada compilers I have used have had some way of defining the size 
of the stack for the environment task. But usually not by pragma 
Storage_Size, unfortunately.

- If you don't want to use the compiler-specific method to size the 
environment task stack, put all of the code into one task, with a large 
Storage_Size.

- If that doesn't work, because your shell or O/S doesn't let you have 
such a large stack, use limit/ulimit to tell the shell or O/S what you need.

- If you don't want to use limit/ulimit, and the stack is still too 
small, you are trying to run the program on a "machine" with too little 
memory resources, and no language can help.

That said, I would welcome a standard Ada way to specify the stack size 
for the environment task. Perhaps Storage_Size could be specified for 
the main subprogram, in the same way as the Priority for the environment 
task.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .


  reply	other threads:[~2018-10-24 20:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-21 21:35 Storage_Size in a Simple Program Charles H. Sampson
2018-10-22  4:00 ` Simon Wright
2018-10-22  5:46 ` Jacob Sparre Andersen
2018-10-22 11:39   ` joakimds
2018-10-22 12:17     ` Egil H H
2018-10-22 13:51       ` Simon Wright
2018-10-24  9:07 ` Charles H. Sampson
2018-10-24 20:51   ` Niklas Holsti [this message]
2018-10-25 13:37     ` joakimds
2018-10-25 15:56       ` Simon Wright
2018-10-25 21:32         ` Niklas Holsti
2018-10-25 21:39         ` joakimds
2018-10-29 20:58           ` Randy Brukardt
2018-10-30 19:31             ` Niklas Holsti
2018-10-31 20:45               ` Randy Brukardt
2018-10-25 22:23   ` Anh Vo
replies disabled

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