!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 { if (!enabled) ret; long megabytes = usedMegabytes(); lvStatus.set("Emergency restart enabled. Memory use: " + megabytes + "/" + max + " MB"); if (megabytes >= max) { setEnabled(false); stefansOS_dumpHeap(); } } }