Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #17580

Re: GC

From Paul Rubin <no.email@nospam.invalid>
Newsgroups comp.lang.forth
Subject Re: GC
References (8 earlier) <50aaad2a$0$289$14726298@news.sunsite.dk> <TLadnZD-sa6zMjfNnZ2dnUVZ_uidnZ2d@supernews.com> <50aab655$0$294$14726298@news.sunsite.dk> <7xboeturwd.fsf@ruckus.brouhaha.com> <50b39c80$0$284$14726298@news.sunsite.dk>
Date 2012-11-26 11:44 -0800
Message-ID <7xr4ngw3my.fsf@ruckus.brouhaha.com> (permalink)
Organization Nightsong/Fort GNOX

Show all headers | View raw


Doug Hoffman <glidedog@gmail.com> writes:
> I have spent some time with a (Anton Ertl's) GC package...  In short I
> was pleasantly surprised at how well the GC works and have softened my
> personal opinion of the GC approach.  

Oh my, I had forgotten where the documentation for Anton's package was,
so I typed "Ertl garbage collection" into a search engine, and the first
hit led to this:

  http://www.3000toys.com/catalog/item_detail.aspx?itemfind=ERTL39464

> I have written a "minimalist" objects extension.  It ... is pretty
> small (about 30 lins of code).  In order to use GC with it one must
> first load the GC code which is about 5 times the size of the objects
> package.  This doesn't bother me but some might not like it.

I think in small or memory-constrained systems, there are few enough
heap objects that manually managing them isn't so bad; and at the same
time, the GC approach has enough memory cost that you don't want to use
it anyway.  (The memory used by the GC itself is quite small, but
between GC runs there will be piled-up dead objects occupying memory
while they wait for collection).  In larger systems where GC helps more,
150 lines of GC code doesn't seem like a big deal if the programmer
doesn't have to think about it too much after loading it.

> Perhaps if GC were part of the ANS standard and most mainstream Forths
> had it already loaded in the kernel or whatever this would not cause
> anyone heartache.

That would be interesting.  I'm not privacy to the workings of the
standardization committee so I can only guess at the sorts of
conniptions that might greet such a proposal ;-).

> - One must manually take care of a "GC resize".  Not a huge deal, but
> it does slow things down.  Not sure how to write dynamically resizable
> entities without a resize function.

You mean you want something like an extensible array inside an object?
Yeah, if it has to stay contiguous then you have to allocate a new
larger block and copy the data.  Alternatively you could allocate in
segments (or a tree structure) and have your lookup function navigate
appropriately.

> - 0 ALLOC will crash if done more than once without resizing 

That sounds like a bug to me, but I haven't used the package yet.

> - Often, when "cleaning up" data such as when closing a file, at the
> same time one uses FREE one also might be resetting variables to 0 or
> some other initial state. 

Some GC's allow attaching finalization code to objects, that gets called
when the object is collected, but I think that approach wouldn't work
with conservative GC, and for resources like file descriptors is too
leaky even with precise GC.  So yeah, GC helps with memory management
but other sorts of resources still need manual attention ;).

> Thanks for the thoughtful explanations.  I will consider GC in future
> projects where I see the need and a good fit.

Excellent, the next step is to get you using Lisp ;-).

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Windows8 visualforth@rocketmail.com - 2012-11-02 08:41 -0700
  Re: Windows8 Brad Eckert <hwfwguy@gmail.com> - 2012-11-02 11:12 -0700
  Re: Windows8 visualforth@rocketmail.com - 2012-11-06 09:05 -0800
    Re: Windows8 Jason Damisch <jasondamisch@yahoo.com> - 2012-11-12 07:10 -0800
      Re: Windows8 stephenXXX@mpeforth.com (Stephen Pelc) - 2012-11-12 17:27 +0000
    Re: Windows8 visualforth@rocketmail.com - 2012-11-21 17:48 -0800
  Re: Windows8 visualforth@rocketmail.com - 2012-11-07 20:44 -0800
  Re: Windows8 Jason Damisch <jasondamisch@yahoo.com> - 2012-11-12 07:15 -0800
    Re: Windows8 Brad Eckert <hwfwguy@gmail.com> - 2012-11-12 07:59 -0800
    Re: Windows8 "Elizabeth D. Rather" <erather@forth.com> - 2012-11-12 07:55 -1000
      Re: Windows8 "Ed" <invalid@nospam.com> - 2012-11-14 20:04 +1100
        Re: Windows8 anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-11-14 17:01 +0000
          Re: Windows8 "Ed" <invalid@nospam.com> - 2012-11-18 11:14 +1100
            Re: Windows8 anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-11-19 14:25 +0000
              Re: Windows8 "Elizabeth D. Rather" <erather@forth.com> - 2012-11-19 08:09 -1000
                Re: Windows8 anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-11-20 09:55 +0000
                Re: Windows8 mhx@iae.nl (Marcel Hendrix) - 2012-11-25 10:56 +0200
                Re: Windows8 Bernd Paysan <bernd.paysan@gmx.de> - 2012-11-25 16:46 +0100
            Re: Windows8 Doug Hoffman <glidedog@gmail.com> - 2012-11-19 16:21 -0500
              Re: Windows8 Paul Rubin <no.email@nospam.invalid> - 2012-11-19 13:46 -0800
                Re: Windows8 Doug Hoffman <glidedog@gmail.com> - 2012-11-19 17:05 -0500
                Re: Windows8 "Elizabeth D. Rather" <erather@forth.com> - 2012-11-19 12:14 -1000
                Re: Windows8 Paul Rubin <no.email@nospam.invalid> - 2012-11-19 14:30 -0800
                Re: Windows8 "Elizabeth D. Rather" <erather@forth.com> - 2012-11-19 12:53 -1000
                Re: Windows8 Doug Hoffman <glidedog@gmail.com> - 2012-11-19 17:44 -0500
                Re: Windows8 Paul Rubin <no.email@nospam.invalid> - 2012-11-19 14:52 -0800
                GC (was Re: Windows8) Doug Hoffman <glidedog@gmail.com> - 2012-11-26 11:44 -0500
                Re: GC Paul Rubin <no.email@nospam.invalid> - 2012-11-26 11:44 -0800
                Re: GC Doug Hoffman <glidedog@gmail.com> - 2012-11-28 06:35 -0500
                Re: GC Paul Rubin <no.email@nospam.invalid> - 2012-11-29 11:58 -0800
                Re: GC albert@spenarnc.xs4all.nl (Albert van der Horst) - 2012-11-30 01:46 +0000
                Re: GC Paul Rubin <no.email@nospam.invalid> - 2012-11-29 21:14 -0800
                Re: Windows8 Paul Rubin <no.email@nospam.invalid> - 2012-11-19 14:42 -0800
                Re: Windows8 Doug Hoffman <glidedog@gmail.com> - 2012-11-19 17:56 -0500
                Re: Windows8 Paul Rubin <no.email@nospam.invalid> - 2012-11-19 15:14 -0800
                Re: Windows8 Doug Hoffman <glidedog@gmail.com> - 2012-11-19 18:45 -0500
                Re: Windows8 "Elizabeth D. Rather" <erather@forth.com> - 2012-11-19 14:18 -1000
                Re: Windows8 Paul Rubin <no.email@nospam.invalid> - 2012-11-19 16:18 -0800
                Re: Windows8 Doug Hoffman <glidedog@gmail.com> - 2012-11-19 19:01 -0500
                Re: Windows8 "Elizabeth D. Rather" <erather@forth.com> - 2012-11-19 12:58 -1000
                Re: Windows8 Bernd Paysan <bernd.paysan@gmx.de> - 2012-11-20 02:23 +0100
                Re: Windows8 anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-11-20 10:48 +0000
                Re: Windows8 Alex McDonald <blog@rivadpm.com> - 2012-11-20 07:56 -0800
                Re: Windows8 anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-11-21 15:03 +0000
                Re: Windows8 Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-11-23 05:58 -0800
                Re: Windows8 Mark Wills <forthfreak@gmail.com> - 2012-11-20 02:13 -0800
                Re: Windows8 Paul Rubin <no.email@nospam.invalid> - 2012-11-20 08:57 -0800
                Re: Windows8 "David N. Williams" <williams@umich.edu> - 2012-11-20 16:56 -0500
                Re: Windows8 mhx@iae.nl (Marcel Hendrix) - 2012-11-25 11:20 +0200
    Re: Windows8 rickman <gnuarm@gmail.com> - 2012-11-14 16:36 -0500
      Re: Windows8 "Elizabeth D. Rather" <erather@forth.com> - 2012-11-14 12:12 -1000
        Re: Windows8 rickman <gnuarm@gmail.com> - 2012-11-14 17:46 -0500
          Re: Windows8 "Elizabeth D. Rather" <erather@forth.com> - 2012-11-14 13:12 -1000
            Re: Windows8 Paul Rubin <no.email@nospam.invalid> - 2012-11-14 18:12 -0800
            Re: Windows8 rickman <gnuarm@gmail.com> - 2012-11-15 13:55 -0500
              Re: Windows8 RR <freedomspyder@gmail.com> - 2012-11-15 16:03 -0800
                Re: Windows8 rickman <gnuarm@gmail.com> - 2012-11-15 21:54 -0500
                Re: Windows8 RR <freedomspyder@gmail.com> - 2012-11-15 19:26 -0800
                Re: Windows8 Paul Rubin <no.email@nospam.invalid> - 2012-11-15 19:27 -0800
                Re: Windows8 Bernd Paysan <bernd.paysan@gmx.de> - 2012-11-16 17:45 +0100
                Re: Windows8 Paul Rubin <no.email@nospam.invalid> - 2012-11-16 09:10 -0800
                Re: Windows8 Bernd Paysan <bernd.paysan@gmx.de> - 2012-11-16 22:34 +0100
                Re: Windows8 Andy Valencia <vandys@vsta.org> - 2012-11-16 18:06 +0000
                Re: Windows8 Paul Rubin <no.email@nospam.invalid> - 2012-11-16 11:09 -0800
                Re: Windows8 Spam@ControlQ.com - 2012-11-16 15:18 -0500
        Re: Windows8 visualforth@rocketmail.com - 2012-11-15 00:19 -0800
          Re: Windows8 "Elizabeth D. Rather" <erather@forth.com> - 2012-11-14 22:55 -1000
          Re: Windows8 albert@spenarnc.xs4all.nl (Albert van der Horst) - 2012-11-15 12:20 +0000
            Re: Windows8 visualforth@rocketmail.com - 2012-11-15 08:32 -0800
            Re: Windows8 kenney@cix.compulink.co.uk - 2012-11-16 04:51 -0600
              Re: Windows8 stephenXXX@mpeforth.com (Stephen Pelc) - 2012-11-16 13:46 +0000
              Re: Windows8 visualforth@rocketmail.com - 2012-11-16 08:12 -0800
  Re: Windows8 the_gavino_himself <visphatesjava@gmail.com> - 2012-11-29 00:16 -0800

csiph-web