!7 set flag OshiNotSticky. cmodule EmergencyHeapDump > DynEnabled { transient SimpleLiveValue lvStatus = stringLiveValue(); switchable int max = 1024; visual centerAndSouthWithMargins(jCenteredLiveValueLabel(lvStatus), super); start { lvStatus.set("Current threshold: " + max + " GB. You have 60s to change this value in this module's menu."); doEvery(60.0, 30.0, r checkIt); // allow 60 seconds after start to change max value } long usedMegabytes() { ret oshi_currentProcessResidentSize()/oneMegabyte(); } void checkIt enter { long megabytes = usedMegabytes(); lvStatus.set("Automatic heap dump " + (enabled ? "enabled" : "disabled") + ". Memory use: " + megabytes + "/" + max + " MB"); if (!enabled) ret; if (megabytes >= max) { setEnabled(false); stefansOS_dumpHeap(); } } }