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=0.6 required=5.0 tests=BAYES_00,TO_NO_BRKTS_FROM_MSSP autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a46843ba8cee64d2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-09-19 07:55:53 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!feed.textport.net!newsranger.com!www.newsranger.com!not-for-mail Newsgroups: comp.lang.ada From: Ted Dennison References: <9oa69d$6ej$1@ns.omskelecom.ru> Subject: Re: dinamic object reclamation Message-ID: X-Abuse-Info: When contacting newsranger.com regarding abuse please X-Abuse-Info: forward the entire news article including headers or X-Abuse-Info: else we will not be able to process your request X-Complaints-To: abuse@newsranger.com NNTP-Posting-Date: Wed, 19 Sep 2001 10:55:36 EDT Organization: http://www.newsranger.com Date: Wed, 19 Sep 2001 14:55:36 GMT Xref: archiver1.google.com comp.lang.ada:13178 Date: 2001-09-19T14:55:36+00:00 List-Id: In article <9oa69d$6ej$1@ns.omskelecom.ru>, Anisimkov says... > procedure act (i : integer) > is > type block is array (1 .. 1024) of integer; > type block_ptr is access all block; > ptr : block_ptr; > begin > ptr := new block; > ptr (ptr'LAst) := i; > put (integer'image(I)); > end; >Is memory allocated by > ptr := new block; >have to be freed automatically after leaving of procedure act ? I believe compilers are allowed, but not required, to garbage collect here. If you want to force the issue w/o using Unchecked_Deallocation, specify a fixed size for Block_Ptr's storage pool. For example, in the above code, add the line: for Block_Ptr'Storage_Size use 4098; and you should be OK (If you get Storage_Error, jack up the number a bit). You won't be able to allocate any more than the specified number of bytes this way, but a conforming compiler *will* reclaim the storage when the access type goes out of scope. (LRM 13.11-18). --- T.E.D. homepage - http://www.telepath.com/dennison/Ted/TED.html home email - mailto:dennison@telepath.com