comp.lang.ada
 help / color / mirror / Atom feed
From: wojtek@power.com.pl (Wojtek Narczynski)
Subject: Re: Basic program with tasks goes out of memory
Date: 6 Aug 2004 08:26:14 -0700
Date: 2004-08-06T08:26:14-07:00	[thread overview]
Message-ID: <5ad0dd8a.0408060726.79490422@posting.google.com> (raw)
In-Reply-To: dfkvec.gv9.ln@skymaster

"Jean-Pierre Rosen" <rosen@adalog.fr> wrote in message 

>> So instead of a single delay you may prefer
>>
>> -- Inner loop:
>> loop
>>     if Dummy'Terminated then
>>        Free (Dummy);
>>        exit;
>>     else
>>        delay 0.01; -- To not hog CPU
>>     end if;
>> end loop;

> If (like me) you don't like busy waiting, you can do the following:
> begin
>    Dummy.Never_Accepted;
> exception
>    when Tasking_Error =>
>       null;
> end;

Yes, if Free (Dummy) is called when the task is not yet terminated,
the program still leaks. I can see that behaviour on an isolated
testcase, but not in my actual code, which probably leaks too slowly.

But in the actual code the idea is to have one task per connection,
which can mean hundreds of tasks. Their time to terminate can be very
different. I don't see how this idea could be extended to hundreds of
tasks. Jano's idea could, but only with polling.

Regards,
Wojtek



  parent reply	other threads:[~2004-08-06 15:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-05 14:55 Basic program with tasks goes out of memory Wojtek Narczynski
2004-08-05 15:18 ` Dmitry A. Kazakov
2004-08-05 16:13 ` Marc A. Criley
2004-08-06  8:54   ` Jano
2004-08-06  9:53     ` Jean-Pierre Rosen
2004-08-06 11:23       ` Jano
2004-08-06 15:26       ` Wojtek Narczynski [this message]
2004-08-06 10:57   ` Wojtek Narczynski
2004-08-05 18:32 ` Jim Rogers
2004-08-07  4:04 ` Dmitriy Anisimkov
replies disabled

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