mirror of
https://github.com/arendst/Tasmota.git
synced 2026-10-27 06:22:25 +00:00
Cap Berry GC threshold growth on PSRAM to avoid multi-second stalls (#25044)
Without this, threshold = usage * 2 (default steprate) lets PSRAM heaps grow unbounded until a GC sweeps tens of thousands of objects out of a nearly-full pool in one go, costing multiple seconds (observed: 4.4s freeing 25k objects from a 2.6MB heap). Cap growth to fixed increments instead, same as the non-PSRAM case, just scaled up for the bigger heap. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0f8da17766
commit
8a7e815f6d
1 file changed
+5
-1
@@ -320,7 +320,11 @@ void BerryObservability(bvm *vm, int event, ...) {
|
||||
);
|
||||
#endif
|
||||
// make new threshold tighter when we reach high memory usage
|
||||
if (!UsePSRAM() && vm->gc.threshold > 20*1024) {
|
||||
if (UsePSRAM()) {
|
||||
if (vm->gc.threshold > 200*1024) {
|
||||
vm->gc.threshold = vm->gc.usage + 100*1024; // increase by 100 KB
|
||||
}
|
||||
} else if (vm->gc.threshold > 20*1024) {
|
||||
vm->gc.threshold = vm->gc.usage + 10*1024; // increase by only 10 KB
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user