[concurrency-interest] LinkedBlockingQueue extract and memory "waste"

Doug Lea dl at cs.oswego.edu
Wed Feb 11 20:02:18 EST 2009

Sorry for delay on this (and on some other concurrency-interest issues) --
I've been swamped with unrelated things.

> The issue is that the method extract() doesn't "help" the GC by
> dereferencing head.next prior to changing the head node (with
> head.next = null;).

Thanks for the empirical demonstration that this is worth doing.
I don't have any religious stance about whether to aggressively
null linkages -- sometimes it is worthwhile and sometimes it
is just unnecessary overhead. I almost always do quick checks
about this when developing classes. While I don't have any
specific recollection, it may be that the effects didn't show
up on the tests, machines, VMs I was using. But these are
subject to transient changes, so it is good to revisit them.

I checked this change into our CVS. Feel free to help get
it into the JDK/openJDK by filing a performance bug report.


More information about the Concurrency-interest mailing list