comp.lang.ada
 help / color / mirror / Atom feed
From: Craig Carey <research@ijs.co.nz>
Subject: Re: Tasks unleashed
Date: Sun, 11 May 2003 17:35:40 +1200
Date: 2003-05-11T17:35:40+12:00	[thread overview]
Message-ID: <sbmrbvc93nshtlfe2g43352ptv5uscbdqn@4ax.com> (raw)
In-Reply-To: MPG.191c7316c64d7b29896f3@News.CIS.DFN.DE

On Fri, 2 May 2003 13:21:13 +0200, Jano <nono@celes.unizar.es> wrote:

>tmoran@acm.org dice...
>> >In any case, the memory thing forces to use pools of reusable tasks,
>> >it's my main and crucial conclusion.
>> 
>>   Have you considered a protected Buffer of work to do and a fixed pool of
>> tasks which queue on an entry waiting for the Buffer to have some work to
>> do (or instructions to quit)?  Then you needn't create or destroy the
>> worker tasks.
>
>That's exactly what I'm doing :) but sometimes the "fixed" compromise 
>bugs me. ITOH, normally is better to have a upper bound for things, I 
>think.


The problem of Ada tasks leaking memory, is 100% absent if the program is
written well enough and either of the 2 compilers named here, are used (in
Windows).

Recovering the memory of a task silently fails if the task was not
 finished.

** Test 1: the memory leak is completely absent:
   for K in 1 .. 20_000 loop  -- N=20,000
      X := new A.Tt;
      N := N + 1;
      X.The_End;
      delay 1.0E-30;    --  [1]
      Free (X);         --  [2]
   end loop;

ObjectAda: 596K for both N=1,000 and N=200,000
GNAT 3.15: 760K, for both N=1,000 and N=200,000

1024 / 200,000 < 1, so no memory was being leaked for each deallocated
 task (in Windows 2000, OA 7.2.2, GNAT 3.15p).

** Test 2: Lines "[1]" and "[2]" are swapped. Now the large memory leak of
the test program is confirmed.

ObjectAda: 47.8MB, N=20,000
GNAT 3.15: 20.7MB, N=20,000,  "-largs --stack=0x40000,0x8000".


Craig Carey ; Ada 95 mailing lists htp://www.ijs.co.nz/ada_95.htm





  parent reply	other threads:[~2003-05-11  5:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-01 14:01 Tasks unleashed Jano
2003-05-01 15:40 ` Stephen Leake
2003-05-01 16:14 ` Robert A Duff
2003-05-01 16:30   ` Jano
2003-05-02  1:14 ` tmoran
2003-05-02 11:21   ` Jano
2003-05-02 23:52     ` tmoran
2003-05-11  5:35     ` Craig Carey [this message]
2003-05-11 15:35       ` Pascal Obry
replies disabled

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