I used UIFlow2 to devleop a simple UI demo, and I monitor the free memory with gc.mem_free(). I found the free memory reduced continiously though I called gc.collect() every loop. Finally, the UI can not update again, but the loop still was running.
Posts made by zhumingqi
-
RE: UiFlow 2.0 discuss(how-to, bug, feature request or sometings)
-
How to solve the UI memory leak?
I used UIFlow2.3.3 to develop a simple UI demo. There is only one image widget to switch 2 JPG images every second. When I monitor the memory with gc.mem_free, I found the memory reduced continiously. And finally, the image switching was stop, but the loop was running. I wonder how to solve the UI memory leak? Here is my python code:
import os, sys, io
import M5
from M5 import *
import timeimage0 = None
oldData14 = NoneImgFlag = None
def setup():
global image0, oldData14, ImgFlagM5.begin()
Widgets.fillScreen(0x000000)
image0 = Widgets.Image("/flash/res/img/default.jpg", 0, 0, scale_x=1, scale_y=1)image0.setImage("/flash/res/img/RotaryBGBacklight.jpg")
ImgFlag = 0def loop():
global image0, oldData14, ImgFlag
M5.update()
if (time.localtime())[5] != oldData14:
PrintFreeMem()
oldData14 = (time.localtime())[5]
if ImgFlag == 0:
image0.setImage("/flash/res/img/RotaryBGBT.jpg")
ImgFlag = 1
elif ImgFlag == 1:
image0.setImage("/flash/res/img/RotaryBGBacklight.jpg")
ImgFlag = 0
else:
passdef PrintFreeMem():
print("Free mem:", gc.mem_free())if name == 'main':
try:
setup()
while True:
loop()
except (Exception, KeyboardInterrupt) as e:
try:
from utility import print_error_msg
print_error_msg(e)
except ImportError:
print("please update to latest firmware")And my UIFlow2 design:
-
RE: UIFlow2.3.3 can not save project or create new project or delete any project
@kuriko It was recover. Thank you.
-
UIFlow2.3.3 can not save project or create new project or delete any project
This morning I can save project normally. This afternoon I try to delete some images from project files, but I failed. And then I try to save the project, also failed. Finally, I found that I can not operate anything successfully online. I just save the project to local firstly.