|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbb.util.MemoryMeasurer.UnitTest.MemoryFiller
public static class MemoryMeasurer.UnitTest.MemoryFiller
Class which attempts to fill up memory to a specified point
.
Is public so that other classes may access.
Field Summary | |
---|---|
private double |
fillPoint
|
private long |
interval
|
private static long |
interval_default
|
private MemoryMeasurer |
measurer
|
private static int |
numObjsCreatedPerLoop
|
private List<Object> |
objects
|
Constructor Summary | |
---|---|
MemoryMeasurer.UnitTest.MemoryFiller(double fillPoint,
long interval,
MemoryMeasurer measurer)
Fundamental constructor. |
|
MemoryMeasurer.UnitTest.MemoryFiller(double fillPoint,
MemoryMeasurer measurer)
Returns this(fillPoint, . |
Method Summary | |
---|---|
void |
fill()
Executes a loop which fills up the memory. |
void |
free()
Removes references to all the objects created by fill so that they can be garbage collected. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final long interval_default
private static final int numObjsCreatedPerLoop
private final double fillPoint
private final long interval
private final MemoryMeasurer measurer
private final List<Object> objects
Constructor Detail |
---|
public MemoryMeasurer.UnitTest.MemoryFiller(double fillPoint, MemoryMeasurer measurer) throws IllegalArgumentException
this(fillPoint, interval_default
, measurer)
.
IllegalArgumentException
public MemoryMeasurer.UnitTest.MemoryFiller(double fillPoint, long interval, MemoryMeasurer measurer) throws IllegalArgumentException
IllegalArgumentException
- if fillPoint <= 0; fillPoint >= 1; interval < 0; measurer == nullMethod Detail |
---|
public void fill() throws InterruptedException
interval
.
Next, it creates several new Object instances and adds them to a List local variable
(so that they cannot be garbage collected as long as this method is being executed);
numObjsCreatedPerLoop
specifies how many Objects are created and added each time.
The loop executes as long as measurer
.getMemoryState
.getAvailableRatio
> fillPoint.
Once the method returns, all the memory that was allocated will be eligible for garbage collection.
InterruptedException
public void free()
fill
so that they can be garbage collected.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |