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,902bff0abea1083d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!prodigy.net!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Why people wants to complicate code with Ada.Unchecked_Deallocation? Date: 27 Jul 2006 19:28:39 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <44c7c3d3$0$47958$4fafbaef@reader3.news.tin.it> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1154043312 13597 192.74.137.71 (27 Jul 2006 23:35:12 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Thu, 27 Jul 2006 23:35:12 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news2.google.com comp.lang.ada:5976 Date: 2006-07-27T19:28:39-04:00 List-Id: Simon Wright writes: > I don't see how having a storage pool of your own affects the need for > unchecked deallocation? If your user wants to return the memory to > your special pool she still has to use deallocation! If you have a lot of objects with similar lifetimes, you can put them all together in one pool, and deallocate the whole pool at once, at the appropriate time. Presuming you have a storage pool type that knows how to do that, of course. This is sometimes safer than deallocating them one by one, because you have fewer places where you need to worry about "when is it safe to deallocate?", and because you can't forget to deallocate some of the individual objects. It sometimes less safe, though, because you might throw the baby out with the bathwater. It depends on the program. It's a very efficient way to manage storage. Allocation can be just a few instructions per object, and deallocation can be a small fraction of one instruction per object. - Bob