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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,aa968038a51ee866 X-Google-Attributes: gid103376,public From: jsa@organon.com (Jon S Anthony) Subject: Re: Q: Ada.Unchecked_Deallocation Date: 1996/07/12 Message-ID: #1/1 X-Deja-AN: 168085451 sender: news@organon.com (news) references: <31E5D4D1.11DB36E1@jinx.sckans.edu> organization: Organon Motives, Inc. newsgroups: comp.lang.ada Date: 1996-07-12T00:00:00+00:00 List-Id: In article <31E5D4D1.11DB36E1@jinx.sckans.edu> David Morton writes: > If something is created dynamically with new, is it > necessary to deallocate it with Ada.Unchecked_Deallocation, Depends on several things. > or will it be removed from the heap space when the program > exits? This certainly will happen without any help from you. In fact the heap itself goes away... > From the "C" world, I've always been taught to clean up after > myself... is this necessary? It seems that usually, "Unchecked" > anything in Ada is bad... If you have a garbage collector (like the Intermetrics AppletMagic Ada/Java system) then you need do nothing in this respect. If you are using controlled types for this sort of storage management you will need to do nothing (well, not after building the types anyway). If your program does not allocate "much" as it runs and has a "short" lifetime, you will not need to bother yourself. If you have your own automatic storage management using your own pools with automatic collections, you will not have to bother (of course, that's a pretty big "if" as you will have to build it or find one). Other than that (and probably a few more) you will need to use Unchecked_Deallocation. NOTE: "Unchecked" stuff in Ada basically _is_ C stuff! F'r'stance: Unchecked_Deallocation is basically just good ol' free (at least from the user's POV). /Jon -- Jon Anthony Organon Motives, Inc. 1 Williston Road, Suite 4 Belmont, MA 02178 617.484.3383 jsa@organon.com