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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,13d6cd0af0d0d769 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-03-23 14:17:32 PST Path: nntp.gmd.de!news.rwth-aachen.de!news.rhrz.uni-bonn.de!news.uni-stuttgart.de!rz.uni-karlsruhe.de!xlink.net!howland.reston.ans.net!gatech!psuvax1!news.pop.psu.edu!hudson.lm.com!godot.cc.duq.edu!toads.pgh.pa.us!evans.pgh.pa.us!user From: evans@evans.pgh.pa.us (Arthur Evans Jr) Newsgroups: comp.lang.ada Subject: Re: Does memory leak? Followup-To: comp.lang.ada Date: Thu, 23 Mar 1995 08:54:32 -0500 Organization: Ada Consulting Distribution: world Message-ID: References: <3kopao$ekg@nef.ens.fr> NNTP-Posting-Host: evans.pgh.pa.us Date: 1995-03-23T08:54:32-05:00 List-Id: In article , eachus@spectre.mitre.org (Robert I. Eachus) wrote: > There are a very few cases where programs are deliberately > designed to leak storage because it is too expensive to avoid it, but > these are very rare. (One case that I had something to do with > involves a command line parameter package...it may be possible to > determine when the storage required goes away, but in most cases you > would be saving less in stack or heap space than you lose to added > code space.) There are several areas where compilers in the early days of Ada leaked. One is for a function that returns an unconstrained type. You can't allocate stack space for the returned value on the call side because you don't know how much space is needed. It's possible though tricky for the callee to put the returned value on its own stack space and for the caller to reclaim that space later. Early implementations often put the result on the heap, and then some failed to release that space. Later, pressures of the market place forced such unpleasantness to be fixed. I suspect that the command line package Robert refers to returns type STRING, an unconstrained type. Note that several functions defined by the standard return unconstrained types: Text_IO.Name Text_IO.Form Beginners have a hard time figuring out how to call these. A related problem is string catenation, since "&" returns a string. Art Evans Arthur Evans Jr, PhD Phone: 412-963-0839 Ada Consulting FAX: 412-963-0927 461 Fairview Road Pittsburgh PA 15238-1933 evans@evans.pgh.pa.us