Memory leak using timers
-
Hello,
LOPY 1.7.9.b3.
if you run the below code, you will see that after many loops it will raise "memory error". To reproduce in fastest way set SLEEP= 0.5. Same is with gc.enable().import gc import utime from machine import Timer class Object: def __init__(self, count=0): print ("Object INIT ", self) self._timer = Timer.Alarm(self._timerCallback, 0.5, periodic=False) def __del__(self): print ("Object DEL ", self) def _timerCallback(self, timer): print("Timer finish " , self) self._timer.cancel() del self._timer self._timer = None print("Start memory %s" %(gc.mem_free())) SLEEP = 1.5 gc.disable() while True: obj = Object(100) utime.sleep(SLEEP) gc.collect() print("\t\tmemory %s" %(gc.mem_free())) -
@Colateral
The most effective place to post bug reports is at https://github.com/pycom/pycom-micropython-sigfox/issuesThe forum is mostly to discuss such bugs, since there's no issue tracking.
-
The issue was posted on github.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login