Describe the bug
I had been running a script on a machine which would identify an image. Without changing anything, the script starting reporting
MemoryError: Out of normal MicroPython Heap Memory! Please reduce the resolution of the image you are running this algorithm on to bypass this issue!
when trying to execute the line img = image.Image(sd_image_path).resize(224,224)
at the start of the script I have the line utils.gc_heap_size(1500000) to ensure there is space in the GC ram to resize the image. Previously I had no issue with this, and the images that I have been testing with have not increased in file size or resolution.
When running the lines after my call to utils.gc_heap_size(1500000)
print("kpu.memtest(): " + str(kpu.memtest()))
print("utils.heap_free(): " + str(utils.heap_free()))
print("utils.gc_heap_size(): " + str(utils.gc_heap_size()))
print("gc.mem_alloc(): " + str(gc.mem_alloc()))
print("gc.mem_free(): " + str(gc.mem_free()))
The board now prints out
###free gc heap memory : 478 KB
###free sys heap memory: 1876 KB
utils.heap_free(): 1921024
utils.gc_heap_size(): 524288
gc.mem_alloc(): 16896
gc.mem_free(): 501120
which shows that my call to utils.gc_heap_size(1500000) is not working.
If I run the exact same script on a healthy board, the same script returns what I'd expect which is
###free gc heap memory : 1418 KB
###free sys heap memory: 924 KB
utils.heap_free(): 946176
utils.gc_heap_size(): 1500000 <- what I expect
gc.mem_alloc(): 15904
gc.mem_free(): 1466592
I'm wondering if there is any solution to this bug? I've tried running the lines
gc.enable()
gc.collect()
machine.reset
and also deiniting the .kmodel I have been using a = kpu.deinit(task), all to no avail on the bugged board. The healthy board does not have any issues.
Please complete the following information
- IDE version: [MaixPy IDE 0.2.5]
- Firmware version: [maixpy_v0.6.2_84_g8fcd84a58_openmv_kmodel_v4_with_ide_support]
- Board: [MaixBit]
- OS: [Windows]
Describe the bug
I had been running a script on a machine which would identify an image. Without changing anything, the script starting reporting
when trying to execute the line
img = image.Image(sd_image_path).resize(224,224)at the start of the script I have the line
utils.gc_heap_size(1500000)to ensure there is space in the GC ram to resize the image. Previously I had no issue with this, and the images that I have been testing with have not increased in file size or resolution.When running the lines after my call to
utils.gc_heap_size(1500000)print("kpu.memtest(): " + str(kpu.memtest()))print("utils.heap_free(): " + str(utils.heap_free()))print("utils.gc_heap_size(): " + str(utils.gc_heap_size()))print("gc.mem_alloc(): " + str(gc.mem_alloc()))print("gc.mem_free(): " + str(gc.mem_free()))The board now prints out
which shows that my call to
utils.gc_heap_size(1500000)is not working.If I run the exact same script on a healthy board, the same script returns what I'd expect which is
I'm wondering if there is any solution to this bug? I've tried running the lines
gc.enable()gc.collect()machine.resetand also deiniting the .kmodel I have been using
a = kpu.deinit(task), all to no avail on the bugged board. The healthy board does not have any issues.Please complete the following information