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,FREEMAIL_FROM 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!news3.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Alex R. Mosteo" Newsgroups: comp.lang.ada Subject: Re: Finalization of static package variables Date: Wed, 09 May 2007 11:13:57 +0300 Message-ID: <5ade66F2nkcgtU1@mid.individual.net> References: <4640f20b$1@news.upm.es> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: individual.net slQpLtLayR0eUjOGjb3gRQlAWYqOrKikDymbN93OXWBvSp6fg= User-Agent: KNode/0.10.4 Xref: g2news1.google.com comp.lang.ada:15671 Date: 2007-05-09T11:13:57+03:00 List-Id: Manuel Collado wrote: > 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). > > If some of these variables contain certain GUI stuff, the program > remains as a zombie process after the main procedure termination. > > After several trial-and-error attemps, an Unchecked_Deallocation on > these variables seems to do the trick (the whole program terminates > smoothly). But this is probably not standard-conformant (ARM 13.11.2-16). > > If there a standard way of forcing finalization of static package > variables at program termination? I.e., without declaring them as > dynamic, or inside a main procedure, or calling explicitly the > finalization actions. You say using Unchecked_Deallocation does work, so that makes me think that your global variables aren't Controlled objects but accesses to controlled objects. Am I right? Deallocating a Controlled object indeed should trigger a Finalize call on it. Otherwise, I would expect that Finalize is called on any Controlled object at program finalization, even if it's a variable at the library level in a package body...