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,7e840873a6d63326 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: HELP memory leaks Date: 1996/03/21 Message-ID: #1/1 X-Deja-AN: 143596054 references: <4irpob$bm5@esdmaster.dsd.northrop.com> organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-03-21T00:00:00+00:00 List-Id: In article <4irpob$bm5@esdmaster.dsd.northrop.com>, Frank Falk wrote: >I am being told two different things concerning memory leaks. Please, >someone tell me what to believe. If you have pointers (access types), then you might have memory leaks. So buy a compiler that supports garbage collection, or else be careful with by-hand Unchecked_Deallocation. If you don't use pointers, your compiler should not give you leaks, IMHO. Unfortunately, some do. How to avoid that? Well, you could buy a compiler that does it right in all cases. Or, you could deal with specific problems. I think some Ada compilers might leak memory for the following: - Function calls, where the result type has a size not known at the call site. E.g. "return String". - Local blocks, in a loop, that declare things whose size is not known at compile time. - Raising exceptions after allocating unknown-sized objects, but before plugging them in to known variables. - Aborting a task while it's allocating such things. Other than that, there should be no problem. But in any case, if a compiler leaks memory (other than due to your own misuse of access types), then send a bug report. Avoiding all types whose size is not know at compile time, is overkill. Avoiding the above-mentioned uses of such types might be wise, although I still view memory leaks as bugs. - Bob