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,b307bd75c8071241 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: newbie Q: storage management Date: 1997/05/04 Message-ID: #1/1 X-Deja-AN: 239333837 References: <5k5hif$7r5@bcrkh13.bnr.ca> <336754A0.41C6@magellan.bgm.link.com> <336A0C55.2781@magellan.bgm.link.com> Organization: New York University Newsgroups: comp.lang.ada Date: 1997-05-04T00:00:00+00:00 List-Id: Sam said <<> 1) Make sure the logic of your code avoids using dangling references. > 2) If memory reclamation is important for your application, make sure that > the implementation supports it. > 3) If your program is large or long-lived enough for memory leakage to be > a problem, make sure you deallocate objects when done with them. (In > this case, (2) definitely applies.)>> You really do not have to worry about 2). There has never been an Ada 83 or Ada 95 compiler that did not support unchecked deallocation for the global heap, so there is nothng that you need to make sure of here. You can freely instantiate Unchecked_Deallocation on library level access types. For access types at a local level, the situation has been less uniform. Compilers with all the following behaviors have existsed: 1. All objects automatically freed on scope exit, explicit unchecked deallocation ignored. 2. All objects automatically freed on scope exit, but unchecked deallocation can be used to free them earlier. 3. No automatic free on scope exit, but unchecked deallocation works fine. For examples, Alsys-386 (case 1) Alsys-SPARC (case 2) GNAT (case 3) Of course in the GNAT case, we are are talking about default behavor, since this is Ada 95, alternative storage pools can be specified to get a behavior different from the default.