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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,56131a5c3acc678e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-03 04:49:22 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!skynet.be!skynet.be!louie!tjb!not-for-mail Sender: lbrenta@lbrenta Newsgroups: comp.lang.ada Subject: Re: Question about OO programming in Ada References: <8urxb.19482$sb4.18182@newsread2.news.pas.earthlink.net> <1792884.HtYz4Yv8lY@linux1.krischik.com> From: Ludovic Brenta User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Date: 03 Dec 2003 13:49:20 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: -= Belgacom Usenet Service =- NNTP-Posting-Host: 217.136.20.187 X-Trace: 1070455761 reader4.news.skynet.be 280 217.136.20.187:46288 X-Complaints-To: usenet-abuse@skynet.be Xref: archiver1.google.com comp.lang.ada:3092 Date: 2003-12-03T13:49:20+01:00 List-Id: Dmitry A. Kazakov writes: > On 03 Dec 2003 10:29:17 +0100, Pascal Obry wrote: > > > > >Dmitry A. Kazakov writes: > > > >> All controlled objects allocated by the allocator new, being not > >> explicity destroyed using Unchecked_Deallocation, will be destroyed > >> upon finalization of the access type. > > > >There is no magic done by Finalize here! Finalize gives a chance to the > >component implementer to do the memory deallocation for the end user. That's > >all. > > Yes, you are right. Controlled objects will be finalized, but the > memory might be not reclaimed. At least, it seems that ARM does not > require that. I am confused. I thought that the storage would be reclaimed when the access type went out of scope, but I tested it with GNAT 3.15p and it isn't. Granted, the ARM doesn't seem to require it, but GNAT has the following in its reference manual: *53*. The manner of choosing a storage pool for an access type when `Storage_Pool' is not specified for the type. See 13.11(17). There are 3 different standard pools used by the compiler when `Storage_Pool' is not specified depending whether the type is local to a subprogram or defined at the library level and whether `Storage_Size'is specified or not. See documentation in the runtime library units `System.Pool_Global', `System.Pool_Size' and `System.Pool_Local' in files `s-poosiz.ads', `s-pooglo.ads' and `s-pooloc.ads' for full details on the default pools used. And in s-pooloc.ads it says: ---------------------------- -- Unbounded_Reclaim_Pool -- ---------------------------- -- Allocation strategy: -- Call to malloc/free for each Allocate/Deallocate -- no user specifiable size -- Space of allocated objects is reclaimed at pool finalization -- Manages a list of allocated objects -- Default pool in the compiler for access types locally declared type Unbounded_Reclaim_Pool is new [...] I tried to run a test program in gnatgdb but couldn't check what the storage pool actually was. Would anyone care to shed some light on this? Now I'm really curious. -- Ludovic Brenta.