LWN.net Logo

Java is new Tk

Java is new Tk

Posted Aug 27, 2011 18:30 UTC (Sat) by BenHutchings (subscriber, #37955)
In reply to: Java is new Tk by tzafrir
Parent article: HP dropping webOS devices

Reference counting can't deal with cycles. Some languages just bail on this (e.g. Perl) but most use a real GC. Even though CPython does reference counting it also has a real GC to break cycles. In a web browser, Javascript code is not trusted, so any implementation must implement real GC.

Reference counting can also result in long pauses due to cascading destruction. In fact, it can be worse than incremental GC in this respect.


(Log in to post comments)

Java is new Tk

Posted Aug 27, 2011 23:47 UTC (Sat) by andresfreund (subscriber, #69562) [Link]

Its not like its impossible to delay destruction in a refcounted scheme. Doing so should be rather simple.
I guess the point is that predictable deletion has nice properties to implement things in an RAIIish fashion which probably outweighs the problems of expensive cascading deletion.

Java is new Tk

Posted Aug 28, 2011 23:03 UTC (Sun) by foom (subscriber, #14868) [Link]

The problem is that it's not actually predictable. It only *seems* predictable. But you could create a reference cycle pointing to your object, and all of a sudden, whoops, doesn't get destructed when you thought it was going to anymore.

There's a reason that Python introduced the "with" statement: to allow for easily-written *actually* predictable resource closing.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds