3 ms·
How do you handle memory fragmentation?
by 5d41402abc4b 1y ago
How do you handle memory fragmentation?
- matt_trentini 1y agoCarefully, at least for devices with higher classifications. Using pre/early allocation helps but, more importantly, we monitor memory use over time in realistic scenarios. We've built tooling, like a memory-profiler [1] that allows us to observe memory consumption and quantify performance over time. However, it turns out that MicroPython has a simple and efficient GC - and once you eliminate code that gratuitously fragments memory it behaves quite predictably. We've tested devices running realistic scenarios for months without failure. [1] https://github.com/pi-mst/micropython-memory-profiler https://github.com/pi-mst/micropython-memory-profiler