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-Thread: 103376,21960280f1d61e84 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!news-feed01.roc.ny.frontiernet.net!nntp.frontiernet.net!newsfeed2.telusplanet.net!newsfeed.telus.net!edtnps90.POSTED!023a3d7c!not-for-mail Sender: blaak@METROID Newsgroups: comp.lang.ada Subject: Re: in defense of GC References: <1169531612.200010.153120@38g2000cwa.googlegroups.com> <1mahvxskejxe1$.tx7bjdqyo2oj$.dlg@40tude.net> <2tfy9vgph3.fsf@hod.lan.m-e-leypold.de> <1g7m33bys8v4p.6p9cpsh3k031$.dlg@40tude.net> <14hm72xd3b0bq$.axktv523vay8$.dlg@40tude.net> <4zwt33xm4b.fsf@hod.lan.m-e-leypold.de> <1j7neot6h1udi$.14vp2aos6z9l8.dlg@40tude.net> <1pzx3y7d2pide.y744copm0ejb$.dlg@40tude.net> <06abzrtuhe.fsf@hod.lan.m-e-leypold.de> From: Ray Blaak Organization: The Transcend Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 06 Feb 2007 18:01:27 GMT NNTP-Posting-Host: 208.66.252.228 X-Trace: edtnps90 1170784887 208.66.252.228 (Tue, 06 Feb 2007 11:01:27 MST) NNTP-Posting-Date: Tue, 06 Feb 2007 11:01:27 MST Xref: g2news2.google.com comp.lang.ada:9030 Date: 2007-02-06T18:01:27+00:00 List-Id: Markus E Leypold writes: > I realize this might not be the beste example, since I just made it > up. But the idea is, that (string ref) is (by the compiler) translated > into a char* and that result := ... actually becomes a malloc() plus a > copying of memory. some_var := None would compile to explicit > deallocation (pointer is overwritten with null). I am not convinced you can avoid GC. Can the compiler insert the appropriate deallocation calls? How would it know the string is not in use somewhere else? So I see only that some sort of reference counting scheme can be implemented in the restricted case, but that is just GC all over again, and a poor one at that. > Similarily, I think, it might be possible to avoid malloc() if > everything is done in static or local buffers. I don't think so. Many algorithms have unbounded and unpredictable memory usage patterns. These could only be handled by viewing the (large?) static buffers as preallocated memory, and then one has the equivalent of malloc and/or GC all over again. -- Cheers, The Rhythm is around me, The Rhythm has control. Ray Blaak The Rhythm is inside me, rAYblaaK@STRIPCAPStelus.net The Rhythm has my soul.