Skip to content

Commit

Permalink
Merge branch 'master' of github.com:3D-e-Chem/knime-testflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sverhoeven committed Mar 25, 2024
2 parents d5b412c + 7148ac7 commit 4e79599
Showing 1 changed file with 1 addition and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@
package nl.esciencecenter.e3dchem.knime.testing.core.ng;

import java.lang.management.ManagementFactory;
import java.lang.management.MemoryPoolMXBean;
import java.lang.management.MemoryType;
import java.lang.management.MemoryUsage;

import org.eclipse.core.runtime.IProgressMonitor;
Expand Down Expand Up @@ -120,20 +118,6 @@ public void aboutToStart() {
protected static MemoryUsage getHeapUsage() {
System.gc();

long initMem = 0;
long maxMem = 0;
long committedMem = 0;
long usedMem = 0;
for (MemoryPoolMXBean memoryPool : ManagementFactory.getMemoryPoolMXBeans()) {
if (memoryPool.getType().equals(MemoryType.HEAP) && (memoryPool.getCollectionUsage() != null)) {
MemoryUsage usage = memoryPool.getUsage();

initMem += usage.getInit();
maxMem += usage.getMax();
committedMem += usage.getCommitted();
usedMem += usage.getUsed();
}
}
return new MemoryUsage(initMem, usedMem, committedMem, maxMem);
return ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
}
}

0 comments on commit 4e79599

Please sign in to comment.