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,ee06257af909a235 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!u30g2000hsc.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Finalization of static package variables Date: 9 May 2007 08:15:25 -0700 Organization: http://groups.google.com Message-ID: <1178723724.958486.24820@u30g2000hsc.googlegroups.com> References: <4640f20b$1@news.upm.es> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1178723731 10635 127.0.0.1 (9 May 2007 15:15:31 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 9 May 2007 15:15:31 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: u30g2000hsc.googlegroups.com; posting-host=66.126.103.122; posting-account=cw1zeQwAAABOY2vF_g6V_9cdsyY_wV9w Xref: g2news1.google.com comp.lang.ada:15677 Date: 2007-05-09T08:15:25-07:00 List-Id: On May 9, 1:20 am, Stephen Leake wrote: > Manuel Collado writes: > > Variables declared in the global scope of a package body seem not to > > be finalized automatically at the end of the whole program (using GNAT > > 3.15p on WindowsXP). > > Is there some reason you are not using a more current version of GNAT? > > > If some of these variables contain certain GUI stuff, the program > > remains as a zombie process after the main procedure termination. > > Technically, that cannot be true; the "main procedure" is the > "environment task", and it does not "terminate" (in the Ada definition > of that word) until all of the tasks it has spawned have "terminated". > > I think that what you are saying is that there are some tasks that > have not terminated when the main procedure is ready to terminate, and > that in fact those tasks never terminate. Except that Manuel never said he was using tasks. I'm envisioning that he probably has a controlled object whose initialization causes some Windows process to be spawned (either directly or via some function in some other GUI library), and finalization causes the process to be terminated. > If the type of the variable is derived from > Ada.Finalization.Controlled or Limited_Controlled, it will be > finalized when it goes out of scope. Otherwise, it won't be. > > However, a static package variable never goes out of scope, so that is > no help. No, I believe that all objects, including static package variables *and* including allocated objects that have not yet been deallocated, are supposed to be finalized when the environment task completes. 10.2(25), 7.6.1(10). -- Adam