comp.lang.ada
 help / color / mirror / Atom feed
From: Pascal Obry <p.obry@wanadoo.fr>
Subject: Re: Tasks unleashed
Date: 11 May 2003 17:35:18 +0200
Date: 2003-05-11T15:35:26+00:00	[thread overview]
Message-ID: <uy91dbio9.fsf@wanadoo.fr> (raw)
In-Reply-To: sbmrbvc93nshtlfe2g43352ptv5uscbdqn@4ax.com


Craig Carey <research@ijs.co.nz> writes:

> 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;

[1] is not right here. The delay could still not be enough. What I usually do
is loop until 'Terminated is true.

Something like: (not compiled)

    for K in 1 .. 20_000 loop  -- N=20,000
       X := new A.Tt;
       N := N + 1;
       X.The_End;

       loop
          exit when X'Terminated;
          delay 1.0E-30;    --  [1]
       end loop;

       Free (X);         --  [2]
    end loop;     

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|         http://perso.wanadoo.fr/pascal.obry
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



      reply	other threads:[~2003-05-11 15: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
2003-05-11 15:35       ` Pascal Obry [this message]
replies disabled

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