Python's biggest compromises
Michael Hudson
mwh at python.net
Mon Aug 4 06:44:39 EDT 2003
hanzspam at yahoo.com.au (Hannu Kankaanpää) writes:
> Michael Hudson <mwh at python.net> wrote in message news:<7h3brv9a9oz.fsf at pc150.maths.bris.ac.uk>...
> > <button nature="hot">
> > Reference counting *is* a form of garbage collection.
> > </button>
>
> You apparently have such a loose definition for garbage
> collection, that even C programs have "a form of garbage
> collection" on modern OSes: All garbage is reclaimed by
> the OS when the program exits. It's just a very lazy collector.
>
> I don't consider something a garbage collector unless it
> collects all garbage (ref.counting doesn't) and is a bit more
> agile than the one provided by OS.
Well, OK, but people do tend to allow a bit of 'conservativeness' in
their collectors, don't they? Boehm's GC-for-C is usually considered
a 'real GC' and that doesn't necessarily collect everything (AIUI, I'm
not an expert in this field).
CPython's 'ref counting + gimmicks' certainly *would* seem to qualify
as a GC, by your definitions.
> > Saying "Ref. counting sucks, let's use GC instead" is a statement near
> > as dammit to meaningless.
>
> You, I and everyone knows what I was talking about, so it could
> hardly be regarded as "meaningless".
Well, OK, but: even if we don't allow refcounting as 'GC' I would
(really!) like to know which form of garbage collection you would use
instead.
> > Given the desires above, I really cannot think of a clearly better GC
> > strategy for Python that the one currently employed. AFAICS, the
> > current scheme's biggest drawback is its memory overhead, followed by
> > the cache-trashing tendencies of decrefs.
>
> It's not "the one currently employed". It's the *two* currently
> employed and that causes grief as I described in my previous post.
You mean two, as in the ones used by Jython and CPython? If have to
admit, I
> And AFAIK, Ruby does use GC (mark-and-sweep, if you wish) and
> seems to be working.
With finalizers? Just curious.
> However, this is rather iffy knowledge. I'm actually longing for
> real GC because I've seen it work well in Java and C#, and I know
> that it's being used successfully in many other languages.
>
> > What would you use instead?
>
> A trick question?
Not at all!
I think it would be practically very difficult to move to a radically
different memory management methodology without breaking the vast
majority of C extensions out there, but I would like to see some
more concrete speculation about alternatives.
Cheers,
mwh
--
Considering that this thread is completely on-topic in the way only
c.l.py threads can be, I think I can say that you should replace
"Oblivion" with "Gravity", and increase your Radiohead quotient.
-- Ben Wolfson, comp.lang.python
More information about the Python-list
mailing list