TPTP 4.3.0 Tracing and Profiling Tools Project
Public API Specification

org.eclipse.equinox.memory
Class MemoryManager

java.lang.Object
  extended byorg.eclipse.equinox.memory.MemoryManager

public class MemoryManager
extends java.lang.Object

This class is a placeholder to collect listeners that want to respond to low memory events. Some listeners may want to clear a cache. Others may want to close editors, entire perspectives, or other resources that consume memory in some form or another.

All this memory manager does is keep a list of listeners and provide a way to broadcast a low-memory event.

An external policy determines when to trigger a broadcast event to be sent to the listeners.

Provisional API: This API is subject to change in the next release.

Field Summary
static int CRITICAL
          Indicates memory is running low at highest severity.
static int LOW
          Indicates memory is running low at the lowest severity.
static int SERIOUS
          Indicates memory is running low at medium severity.
 
Constructor Summary
MemoryManager()
           
 
Method Summary
static void addLowMemoryListener(LowMemoryListener listener)
          Register a listener with the memory manager.
static void broadcastLowMemory(int severity)
          Broadcast a low memory event.
static java.util.List getListeners()
           
static void removeListener(LowMemoryListener listener)
          Remove a low memory listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOW

public static final int LOW
Indicates memory is running low at the lowest severity. Listeners are requested to release caches that can easily be recomputed. The java VM is not seriously in problem, but process size is getting higher than is deemed acceptable.

See Also:
Constant Field Values

SERIOUS

public static final int SERIOUS
Indicates memory is running low at medium severity. Listeners are requested to release intermediate build results, complex models, etc. Memory is getting low and may cause operating system level stress, such as swapping.

See Also:
Constant Field Values

CRITICAL

public static final int CRITICAL
Indicates memory is running low at highest severity. Listeners are requested to do things like close editors and perspectives, close database connections, etc. Restoring these resources and caches constitutes lots of work, but memory is so low that drastic measures are required.

See Also:
Constant Field Values
Constructor Detail

MemoryManager

public MemoryManager()
Method Detail

addLowMemoryListener

public static void addLowMemoryListener(LowMemoryListener listener)
Register a listener with the memory manager. After registering, lhe listener will be notified of situations where memory is running low with an indication of the severity.

Parameters:
listener - the listener that can clean up memory
Provisional API: This API is subject to change in the next release.

removeListener

public static void removeListener(LowMemoryListener listener)
Remove a low memory listener.

Parameters:
listener - the listener to remove
Provisional API: This API is subject to change in the next release.

broadcastLowMemory

public static void broadcastLowMemory(int severity)
Broadcast a low memory event.

Parameters:
severity - either LOW, SERIOUS, or CRITICAL

getListeners

public static java.util.List getListeners()
Returns:
the current list of listeners

TPTP 4.3.0 Tracing and Profiling Tools Project
Public API Specification