Add log for free memory

This commit is contained in:
Manfred Karrer 2019-01-21 19:05:30 +01:00
parent f0dd8322de
commit e12f11e538
No known key found for this signature in database
GPG key ID: 401250966A6B2C46

View file

@ -137,9 +137,9 @@ public abstract class ExecutableForAppWithP2p extends BisqExecutable implements
double warningTrigger = maxMemory * 0.8;
if (usedMemoryInMB > warningTrigger) {
log.warn("\n\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n" +
"We are over 80% of our memory limit ({}) and call the GC. usedMemory: {} MB" +
"We are over 80% of our memory limit ({}) and call the GC. usedMemory: {} MB. freeMemory: {} MB" +
"\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n\n",
(int) warningTrigger, usedMemoryInMB);
(int) warningTrigger, usedMemoryInMB, Profiler.getFreeMemoryInMB());
System.gc();
Profiler.printSystemLoad(log);
}
@ -148,9 +148,9 @@ public abstract class ExecutableForAppWithP2p extends BisqExecutable implements
long usedMemory = Profiler.getUsedMemoryInMB();
if (usedMemory > maxMemory) {
log.warn("\n\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n" +
"We are over our memory limit ({}) and trigger a restart. usedMemory: {} MB" +
"We are over our memory limit ({}) and trigger a restart. usedMemory: {} MB. freeMemory: {} MB" +
"\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n\n",
(int) maxMemory, usedMemory);
(int) maxMemory, usedMemory, Profiler.getFreeMemoryInMB());
restart(environment, gracefulShutDownHandler);
}
}, 5);