how to count lines in a file ?

Tim Peters tim.one at comcast.net
Thu Jul 25 22:01:29 EDT 2002


[Richard Jones]
> I think the major problem that we're running into here is that
> before there was GC, the refcounting-based cleanup of objects was clear,
> straight-forward and reliable. Now it's not clear when objects are
> cleared up.

Then you don't understand CPython's flavor of gc:  refcounting didn't go
away in CPython.  Anything that got cleaned up by magic in Python 1.0 still
gets cleaned up by magic, and at exactly the same time it used to get
cleaned up.  In addition, many kinds of memory leaks (involving cycles) in
older CPython implementations have gone away.  CPython's cyclic gc is solely
concerned with unreachable objects in cycles; all such objects leaked
forever before CPython grew cyclic gc.  Everything else is still cleaned up
by refcounting in CPython.

> That's a fairly major problem for some of us old-timers

Yet it shouldn't be "a problem" at all.  Nothing has changed except that you
have fewer memory leaks.

> (and, quite possibly, a lot of newbies) to come to terms with. I hadn't
> realised that GC threw such a big, ugly spanner in the works :(

Did you catch that the example was run under Jython?  Jython never used
refcounting.





More information about the Python-list mailing list