|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.icepdf.core.util.MemoryManager
public class MemoryManager
The MemoryManager class is a utility to help manage the amount of memory
available to the application. When memory intensive operations are about
occur, the MemoryManager is asked if it can allocate the needed amount of memory.
If there is not enough memory available, the MemoryManager will purge the
cache to try and free the requested amount of memory.
| Field Summary | |
|---|---|
protected long |
cumulativeDurationManagingMemory
|
protected long |
cumulativeDurationNotManagingMemory
|
protected java.util.ArrayList<MemoryManagerDelegate> |
delegates
|
protected java.util.ArrayList<MemoryManageable> |
leastRecentlyUsed
|
protected java.util.WeakHashMap<java.lang.Object,java.util.HashSet<MemoryManageable>> |
locked
|
protected long |
maxMemory
The maximum amount of memory allocated to the JVM. |
protected int |
maxSize
If a memory-based ceiling, like maxMemory, is not sufficient, then you can use maxSize to specify the maximum number of items that may be opened before purging commences. |
protected long |
minMemory
The minimum amount of free memory at which the memory manager will force a purge of the cached pageTree. |
protected int |
percentageDurationManagingMemory
|
protected long |
previousTimestampManagedMemory
|
protected int |
purgeSize
When we decide to reduce our memory footprint, this is how many items we purge at once. |
protected java.lang.Runtime |
runtime
Runtime object responsible for returning VM memory use information |
| Constructor Summary | |
|---|---|
protected |
MemoryManager()
Creates a new instance of a MemoryManager. |
| Method Summary | |
|---|---|
boolean |
checkMemory(int memoryNeeded)
|
long |
getFreeMemory()
Get runtime free memory. |
static MemoryManager |
getInstance()
Get an instance of the MemoryManager. |
long |
getMinMemory()
Get the minimum amount of memory |
protected boolean |
isLocked(MemoryManageable mm)
|
boolean |
isLowMemory()
Check whether the runtime is low on memory. |
void |
lock(java.lang.Object user,
MemoryManageable mm)
|
protected boolean |
reduceMemory()
|
protected int |
reduceMemory(int numToDo)
|
protected boolean |
reduceMemoryWithDelegates(boolean aggressively)
|
void |
registerMemoryManagerDelegate(MemoryManagerDelegate delegate)
|
void |
release(java.lang.Object user,
MemoryManageable mm)
|
void |
releaseAllByLibrary(Library library)
|
void |
setMinMemory(long m)
Set the minimum amount of memory. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final java.lang.Runtime runtime
protected long minMemory
protected long maxMemory
protected int purgeSize
protected int maxSize
protected java.util.WeakHashMap<java.lang.Object,java.util.HashSet<MemoryManageable>> locked
protected java.util.ArrayList<MemoryManageable> leastRecentlyUsed
protected long cumulativeDurationManagingMemory
protected long cumulativeDurationNotManagingMemory
protected long previousTimestampManagedMemory
protected int percentageDurationManagingMemory
protected java.util.ArrayList<MemoryManagerDelegate> delegates
| Constructor Detail |
|---|
protected MemoryManager()
MemoryManager.
| Method Detail |
|---|
public static MemoryManager getInstance()
MemoryManager. If there is not a MemoryManager
initiated, a new MemoryManager is is created and returned.
MemoryManager object org.icepdf.core.minMemory
public void lock(java.lang.Object user,
MemoryManageable mm)
public void release(java.lang.Object user,
MemoryManageable mm)
public void registerMemoryManagerDelegate(MemoryManagerDelegate delegate)
public void releaseAllByLibrary(Library library)
protected boolean reduceMemory()
protected int reduceMemory(int numToDo)
protected boolean isLocked(MemoryManageable mm)
protected boolean reduceMemoryWithDelegates(boolean aggressively)
public void setMinMemory(long m)
m - minimum amount of memory that should be kept free on the heappublic long getMinMemory()
public long getFreeMemory()
public boolean isLowMemory()
public boolean checkMemory(int memoryNeeded)
memoryNeeded - memory looking to allocate
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||