[concurrency-interest] TheadLocal variable usage inReentrantReadWriteLock

David Holmes dcholmes at optusnet.com.au
Fri Dec 14 00:04:07 EST 2007


Hi Rob,

Yes this is a known issue in Java 6. I think there's been some discussion on
the list if you search the archive. Otherwise see:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6625723

The number of RRWL used in an application was expected to be relatively
small given that their benefits only become apparent in certain use-cases.
So the ThreadLocal overhead wasn't expected to be a significant issue.

For Java 7 the best solution might be to make the read counts optional.
Other approaches are also being looked at.

David Holmes

  -----Original Message-----
  From: concurrency-interest-bounces at cs.oswego.edu
[mailto:concurrency-interest-bounces at cs.oswego.edu]On Behalf Of Rob Griffin
  Sent: Friday, 14 December 2007 1:01 PM
  To: Concurrency Interest
  Subject: [concurrency-interest] TheadLocal variable usage
inReentrantReadWriteLock


  Hello,



  I'm seeing a significant number (dozens) of ThreadLocal variables
containing values of type ReentrantReadWriteLock$Sync$HoldCounter in a
single thread. From the code it would appear that each new
ReentrantReadWriteLock instance creates a new ThreadLocal variable named
readHolds which is never cleared. Is my interpretation correct?



  This is in Java 1.6.0_03



  Regards,



  Rob Griffin.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20071214/2e437250/attachment.html 


More information about the Concurrency-interest mailing list