public class GenerationMemoryStrategy extends MemoryStrategy
Modifier and Type | Field and Description |
---|---|
private java.lang.management.MemoryPoolMXBean |
eden |
private java.lang.management.MemoryMXBean |
heap |
private static long |
M |
private java.lang.management.MemoryPoolMXBean |
old |
private java.lang.management.MemoryPoolMXBean |
survivor |
error, lastGC, log, name
Constructor and Description |
---|
GenerationMemoryStrategy() |
Modifier and Type | Method and Description |
---|---|
protected long |
available()
memory that is available including increasing total memory up to maximum
Smallest of both old and young
|
private long |
available(boolean force)
memory that is available including increasing total memory up to maximum
|
protected long |
free()
memory that is free without increasing of total memory taken from os
|
private java.lang.management.MemoryUsage |
getUsage(java.lang.management.MemoryPoolMXBean bean,
boolean collected) |
private boolean |
initPoolBeans() |
protected long |
maxMemory()
maximum memory the Java virtual will allocate machine; may vary over time in some cases
|
protected long |
minMemory()
get the memory that needs to be available for properState
|
private long |
oldAvailable() |
protected boolean |
properState()
alive objects get 'moved' on gc from eden space to survior and from survior to old gen
in a worse case (all objects of survivor alive) all objects get 'moved' from suvivor to old gen
this method checks if there is is space left in old gen for that
|
private boolean |
properState(boolean force) |
protected long |
recommendHeapSize()
based on my research for a proper running jvm, this gives a guidance value for the heap size
|
protected boolean |
request(long size,
boolean force,
java.util.concurrent.atomic.AtomicBoolean shortStatus)
checks if a specified amount of bytes are available
after the jvm recycled unused objects
|
protected long |
total()
currently allocated memory in the Java virtual machine; may vary over time
|
protected long |
used()
memory that is currently bound in objects
|
private long |
youngAvailable()
use this to check for temporary space
|
gc, getName, hasError, resetProperState, setProperMbyte
private static final long M
private java.lang.management.MemoryPoolMXBean eden
private java.lang.management.MemoryPoolMXBean survivor
private java.lang.management.MemoryPoolMXBean old
private java.lang.management.MemoryMXBean heap
protected final long free()
free
in class MemoryStrategy
protected final long available()
available
in class MemoryStrategy
private final long available(boolean force)
force
- specifies whether ignoring prefered sizeprotected final long used()
used
in class MemoryStrategy
protected final long total()
total
in class MemoryStrategy
protected final long maxMemory()
maxMemory
in class MemoryStrategy
protected final long minMemory()
protected final boolean request(long size, boolean force, java.util.concurrent.atomic.AtomicBoolean shortStatus)
request
in class MemoryStrategy
size
- the requested amount of free memory in bytesforce
- specifies whether ignoring preferred sizeprivate final long youngAvailable()
private final long oldAvailable()
protected boolean properState()
properState
in class MemoryStrategy
private boolean properState(boolean force)
force
- whether using used or committed survivor usageprotected long recommendHeapSize()
private java.lang.management.MemoryUsage getUsage(java.lang.management.MemoryPoolMXBean bean, boolean collected)
collected
- specifies whether trying to get the memory usage after the jvm recycled unused objectsprivate boolean initPoolBeans()