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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable 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 08:02:00 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!fr.usenet-edu.net!usenet-edu.net!enst!enst.fr!not-for-mail From: "David C. Hoos" Newsgroups: comp.lang.ada Subject: Re: dinamic object reclamation Date: Wed, 19 Sep 2001 10:02:36 -0500 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: References: <9oa69d$6ej$1@ns.omskelecom.ru> Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1000911719 58436 137.194.161.2 (19 Sep 2001 15:01:59 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Wed, 19 Sep 2001 15:01:59 +0000 (UTC) To: Return-Path: X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.4 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , List-Archive: Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:13179 Date: 2001-09-19T10:02:36-05:00 Yes, you have to use Ada.Unchecked_Deallocation to free the memory. Types derived from Ada.Finalization.Controlled can have their memory automatically freed when execution leaves the scope in which it was declared. ----- Original Message ----- From: "Anisimkov" Newsgroups: comp.lang.ada To: Sent: Wednesday, September 19, 2001 9:27 AM Subject: dinamic object reclamation > I wrote the test program about it. > ----------------------------- > with text_io; use text_io; > procedure alloc is > > dummy : character; > > 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; > > begin > for i in 1..20000 loop > act (i); > get_immediate(dummy); > end loop; > end; > -------------------- > The question is: > Is memory allocated by > ptr := new block; > have to be freed automatically after leaving of procedure act ? > Am I have to use Ada.Unchecked_Deallocation for free memory ? > I'm acking becouse there is a memory leak without Unchecked_Deallocation > when program compiled in the GNAT 3.13. > Is it bug or regular behavior ? > > > > > _______________________________________________ > comp.lang.ada mailing list > comp.lang.ada@ada.eu.org > http://ada.eu.org/mailman/listinfo/comp.lang.ada >