From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b0e28886667436ea X-Google-Attributes: gid103376,public From: Jonas Nygren Subject: Re: Task storage Date: 1998/02/25 Message-ID: <34F3CFE8.D88A8B15@ehpt.com>#1/1 X-Deja-AN: 328438891 Content-Transfer-Encoding: 7bit References: <34F30CB0.CD9@obs-vlfr.fr> X-Priority: 3 (Normal) Mime-Version: 1.0 To: laval@obs-vlfr.fr Content-Type: text/plain; charset=us-ascii Organization: EHPT Newsgroups: comp.lang.ada Date: 1998-02-25T00:00:00+00:00 List-Id: Philippe Laval wrote: > > My Ada 95 application, compiled with Gnat 3.10 under Windows 95, > recursively allocates large tasks (about 1_000 instructions). > Storage_Error is raised after only a few ten tasks are created, despite > the 40 Mbytes available on my machine. I need about 12 Kbytes of stack > per task. The default storage pool is obviously too small. I would like > to set up a user defined pool object, according to the chapter 13.11 of > the ALRM, but the examples given make not very clear how Allocate could > be overridden to reserve 12 Kbytes each time "new" is executed. Where > can I find some examples which could be adapted to solve my problem? This limitation is Win95 dependent. Windows and NT apparently set aside a fixed size portion of the address space to use for the per-thread data (stack, ...). This fixed size is determined by a constant in the program which can be controlled via attributes to the gnu linker, I don't remember exactly how this was done. Gnat's default setting is a fairly large size for this area, most users probably only have a few tasks and do not want to be bothered with task size calculation. So a 'big-enough' size was chosen. If you know what you're doing you could use the linker parameter to change this size to fit your specific needs. I have tried this and run with 1000+ thread scheduled Ada tasks in Gnat. If you don't need to have thread scheduled tasks, ie you don't have your tasks synchronised by the OS kernel (eg IO) then Gnat provide support for such tasks also. I believe the number of such tasks is only limited by available memory and you could use attributes such as Storage_Size to manipulate the amount of memory allocated to each task. It was some time ago I looked into this and I hope my memory hasn't failed me. You could also check some Gnat FAQ, if there is any. /jonas