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,ea9fbf0f08e5af8a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!newsfeed2.dallas1.level3.net!news.level3.com!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Delayed deallocation of non-terminated task in Gnat? Date: Wed, 31 Aug 2011 14:08:26 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <31ba531d-fa8e-40f3-97bc-c9112b329fe2@14g2000prv.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1314814107 26886 192.74.137.71 (31 Aug 2011 18:08:27 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Wed, 31 Aug 2011 18:08:27 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:mXrWuZ828dx+McK7+DcIOAY/Tr4= Xref: g2news2.google.com comp.lang.ada:21764 Date: 2011-08-31T14:08:26-04:00 List-Id: Marc C writes: > This *looks* to me like one could dynamically allocate a task instance > and then immediately free it with an instantiation of > Unchecked_Deallocation, yet the task would continue to function > normally until it terminates. Yes. Ada semantics requires that if you call Unchecked_Deallocation on an object that contains running tasks, the tasks keep running. In the old version of GNAT, U_D would say "Is the task terminated? If so, free up its resources. If not, do nothing." So it could leak memory. The new version of GNAT is better: "Is the task terminated? If so, free up its resources. If not, cause its resources to be freed up when it does terminate." But you have to be careful: Like any U_D, you can have dangling pointers. - Bob