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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f4fd2,8e3b3db66f3b0061 X-Google-Attributes: gidf4fd2,public X-Google-Thread: 109fba,8e3b3db66f3b0061 X-Google-Attributes: gid109fba,public X-Google-Thread: 1014db,8e3b3db66f3b0061 X-Google-Attributes: gid1014db,public X-Google-Thread: fd443,8e3b3db66f3b0061 X-Google-Attributes: gidfd443,public X-Google-Thread: 103376,474d28ddf953b3c1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-12-12 11:27:33 PST Newsgroups: alt.lang.design,comp.lang.c,comp.lang.c++,comp.lang.lisp,comp.lang.ada Path: nntp.gmd.de!Germany.EU.net!howland.reston.ans.net!agate!darkstar.UCSC.EDU!news.hal.COM!decwrl!netcomsv!netcom.com!hbaker From: hbaker@netcom.com (Henry G. Baker) Subject: Re: Reference Counting (was Re: Searching Method for Incremental Garbage Collection) Message-ID: Organization: nil References: Date: Mon, 12 Dec 1994 05:04:25 GMT Xref: nntp.gmd.de comp.lang.c:71807 comp.lang.c++:82424 comp.lang.lisp:9541 comp.lang.ada:17436 Date: 1994-12-12T05:04:25+00:00 List-Id: In article gmckee@cloudnine.com (Gary McKee) writes: >In Article , bobduff@dsd.camb.inmet.com >(Bob Duff) wrote: >>In article , >>Henry G. Baker wrote: >>>I just wanted to point out again that objects whose reference counts >>>are always one, and the programmer/compiler knows this, avoid the >>>usual overheads of reference counting. >> >>But it seems to me that in a language like Ada, if a given object only >>has one reference pointing to it, and that fact is known at compile >>time, then you would almost always declare that object as a normal >>stack-allocated object. So it would not be in the heap in the first >>place, so reference counting would never occur. >================================================================ >One counter-example would be the situation with compilers that limit the >size of the stack space but not the size of the heap. > >I have placed large, static arrays with predefined values onto the heap in >order to leave the stack space for subprogram usage (especially recursive >subprograms). Another common example is a function that returns an object of arbitrary size. You don't know how much space to allocate for it on the stack, and if you simply redefine the stack frame to include the object (which was stack-allocated by the called function), then you may waste huge amounts of space on the stack. So you're better off allocating it in a heap, but remembering that you have only one pointer to it. Henry Baker Read (192.100.81.1) ftp.netcom.com:/pub/hb/hbaker/README for ftp-able papers. WWW archive: ftp://ftp.netcom.com/pub/hb/hbaker/home.html ************* Note change of address ^^^ ^^^^ (It _is_ accessible, but Netcom is loaded; keep trying.)