I ran into an unexpected behavior on WiPy. I wrote a little test program which allocates memory. That should run into an exception at a certain point. With PyBoard, it does. With WiPy, it does NOT. WiPy simply stalls. No reaction on Telnet, not heartbeat LED.
This is the test code:
Code: Select all
import gc, micropython
micropython.alloc_emergency_exception_buf(400)
def alloctest(n):
gc.collect()
list = []
for i in range(n):
try:
list.append("{} *************************************************".format(i))
except:
print("Exception at count ", i)
return
del list
gc.collect()
print("Fine run of {} cycles, free memory {}".format(n, gc.mem_free()))
Code: Select all
MicroPython v1.5.2-89-g7417ccf on 2016-01-29; PYBv1.0 with STM32F405RG
>>> import alloctest
>>> alloctest.alloctest(100)
Fine run of 100 cycles, free memory 85296
>>> alloctest.alloctest(800)
Exception at count 726
Code: Select all
MicroPython v1.5.2-97-gef5f266 on 2016-01-30; WiPy with CC3200
>>> import alloctest
>>> alloctest.alloctest(100)
Fine run of 100 cycles, free memory 41968
>>> alloctest.alloctest(400)
Regards