CDV ❯ cyclicbarrier creates lots of garbage?
-
Bug
-
Status: Resolved
-
2 Major
-
Resolution: Won't Fix
-
-
-
interfaces
-
Reporter: tgautier
-
September 29, 2008
-
0
-
Watchers: 1
-
February 12, 2014
-
February 12, 2014
Attachments
Description
Probably not a big deal, but it seems every await() call in CyclicBarrier creates a new object.
See the attached screenshot for a test that runs a cyclicbarrier with 5 processes/threads. The overall rate of barrier acquisition is between 20-30, which corresponds very well with the object creation rate, e.g. 5*20 is 100, which is the object flush and fault rate, indicating to me that new objects are used to indicate an arrival of a thread (I haven’t seen the code - maybe they are being put into a map?)
Comments
Taylor Gautier 2008-09-29
Taylor Gautier 2008-10-01
seems cyclic barrier creates an inner class which is the source of the garbage
Hung Huynh 2014-02-12
DSO is discontinued
I have implemented a small version of code that uses just a counter (it should be a long, not an int):
public class MyCyclicBarrier { private final int parties; private int joined = 0;