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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,6b353437b73507a5 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews2.google.com!not-for-mail From: wojtek@power.com.pl (Wojtek Narczynski) Newsgroups: comp.lang.ada Subject: Re: Basic program with tasks goes out of memory Date: 6 Aug 2004 08:26:14 -0700 Organization: http://groups.google.com Message-ID: <5ad0dd8a.0408060726.79490422@posting.google.com> References: <5ad0dd8a.0408050655.355fa926@posting.google.com> <2nf4m2F7cpkU1@uni-berlin.de> <2ngv8lFnp34U1@uni-berlin.de> NNTP-Posting-Host: 62.111.211.178 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1091805974 23649 127.0.0.1 (6 Aug 2004 15:26:14 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 6 Aug 2004 15:26:14 +0000 (UTC) Xref: g2news1.google.com comp.lang.ada:2609 Date: 2004-08-06T08:26:14-07:00 List-Id: "Jean-Pierre Rosen" 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