uasyncio code - memory usage constantly increasing #11488
-
just trying some uasyncio experiments on an ESP32-c3. My code is based on what I can find and understand from examples is show below. It seems to continually use memory more and more as it loops TIA
This example is ok and does not use up memory continuously:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Please format code with back ticks, see Welcome post. |
Beta Was this translation helpful? Give feedback.
-
thanks - no idea why my post is not formatted correctly - I'm sure I put in the correct back ticks. will edit post. |
Beta Was this translation helpful? Give feedback.
-
This is what happens.: Start of program- memory use is:
After about half and hour the memory gets all used up, and then goes back up to close to the starting values. I guess the GC is doing its thing ok(??).There is no error or crash.
|
Beta Was this translation helpful? Give feedback.
-
@steeley The way to check for memory leaks is first to issue What you are measuring is the normal process whereby blocks of memory are allocated. Subsequently all references to the block of RAM go out of scope. The RAM is still seen as being used until a GC is performed, when the lack of references is detected and the block is reclaimed. As a general point I have used |
Beta Was this translation helpful? Give feedback.
@steeley The way to check for memory leaks is first to issue
gc.collect()
then to check free RAM, the aim being to detect permanently allocated RAM.What you are measuring is the normal process whereby blocks of memory are allocated. Subsequently all references to the block of RAM go out of scope. The RAM is still seen as being used until a GC is performed, when the lack of references is detected and the block is reclaimed.
As a general point I have used
uasyncio
extensively in long running applications and have never detected a leak.