List of usage examples for java.lang.management MemoryMXBean gc
public void gc();
From source file:org.rhq.enterprise.agent.promptcmd.GCPromptCommand.java
private void freeMemory(PrintWriter out) { final MemoryMXBean memoryMxBean = ManagementFactory.getMemoryMXBean(); printGlobalMemoryUsage(out, memoryMxBean); // free up some global static caches Introspector.flushCaches();// ww w . jav a 2 s . co m LogFactory.releaseAll(); // invoke the garbage collector out.println(MSG.getMsg(AgentI18NResourceKeys.GC_INVOKE)); memoryMxBean.gc(); printGlobalMemoryUsage(out, memoryMxBean); return; }