Skip to content

Commit

Permalink
IDEMPIERE-6130 Show gc information (#2339)
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosRuiz-globalqss committed Apr 26, 2024
1 parent d707ffd commit ff19f11
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -120,9 +120,15 @@ public AboutWindow() {
*/
private void init() {

Runtime runtime = Runtime.getRuntime();
long usedMemoryBefore = runtime.totalMemory() - runtime.freeMemory();
System.runFinalization();
System.gc();

try {Thread.sleep(100);} catch (InterruptedException e) {} // Give some time for GC to complete
long usedMemoryAfter = runtime.totalMemory() - runtime.freeMemory();
long freedMemory = usedMemoryAfter - usedMemoryBefore;
log.warning(String.format("Memory: total %,d, before gc: %,d, after gc %,d, freed by gc %,d bytes%n", runtime.totalMemory(), usedMemoryBefore, usedMemoryAfter, freedMemory));

this.setPosition("center");
this.setTitle(ThemeManager.getBrowserTitle());
this.setSclass("popup-dialog about-window");
Expand Down

0 comments on commit ff19f11

Please sign in to comment.