[Tim Peters] >> Python-style refcounting isn't generally a good approach either when >> real-time constraints must be met: when a refcount on an object P >> falls to 0, not only does the interpreter "pause" to reclaim P, but >> also to reclaim all the objects that were reachable only from P.
[Martin v. Löwis] > Sure - but that still allows for meeting real-time constraints. I doubt people who work in hard real-time would agree -- I'm just regurgitating the standard line here. For recent work, see: The Space Cost of Lazy Reference Counting Boehm, Hans-J. POPL 2004, or online at http://www.hpl.hp.com/techreports/2003/HPL-2003-215.html Reference counting memory management is often advocated as a technique for reducing or avoiding the pauses associated with tracing garbage collection. We present some measurements to remind the reader that classic reference count implementations [i.e., "Python-style refcounting" - tim] may in fact exhibit longer pauses than tracing collectors. We then analyze reference counting with lazy deletion, the standard technique for avoiding long pauses by deferring deletions and associated reference count decrements, [which is indeed the standard technique for making refcounting friendlier to real-time work - tim] usually to allocation time. ... > ... > In a specific program, analysis is much brighter. You *know* what > variables carry references to huge data structures, and you *know* > where these variables are assigned to. > ... Most people work with countless lines of library code they didn't write, and whose internals aren't documented at all. When I do myinstance.a = zope.app.frobulater.gringo() did I just create a reference to a huge new data structure? I have no idea. How long will refcounting take to clean up mysinstance.a when myinstance becomes trash? Ditto. Multiply by many thousands. "Lazy" refcounting guarantees "not long" regardless -- although it introduces other problems. > ... _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com