help with leaking memory management

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: help with leaking memory management

Post by pythoncoder » Thu Jan 28, 2016 5:32 am

@bmarkus As mentioned above the best way to mitigate heap fragmentation in a running program is periodically to run gc.collect().
Peter Hinch
Index to my micropython libraries.

mianos
Posts: 84
Joined: Sat Aug 22, 2015 6:42 am

Re: help with leaking memory management

Post by mianos » Fri Feb 05, 2016 11:25 pm

After running a GC everything was fine until I had another infuriating small leak I couldn't track down.
After much grumbling to myself and not touching it for a few days I debugged my way into the GC and found I was getting a little carried away 'interning' http header values. Although the header key is a pretty good candidate for interning the head value certainly isn't!
Think, at the very least, the timestamp changes and when that different value gets interned you eventually run out of memory, slowly but surely. (LOLs go here).

Back to 100,000 requests no problems. :)

Post Reply