Code:
That was a smart idea, I tried reserving it in boot.py but now something very strange seems to be happening. My program does not get to run and I get the following memory allocation error:If you can't reserve the memory where you are trying to reserve it, perhaps reserve it earlier, in 'boot.py' ?I just need to be able to reserve a chunk for my socket connection to succeed..
If your attempt to reserve 32KB is at the very start of 'main.py' it seems the compilation of that has eaten some 100KB for executable bytecode storage and seemingly, somehow, fragmented the 100KB left such that there isn't a 32KB contiguous block.
You can check that by using 'micropython.mem_info(1)' at the start of 'main.py'.
If it's not fragmented, a 32KB block should be reservable, you would have to ask MicroPython why that is not working.
If it is fragmented you will have to analyse what in you 'main.py' is causing that, figure out a way around that.
Code:
MemoryError: memory allocation failed, allocating 342 byte
Code:
>>> import testTraceback (most recent call last): File "<stdin>", line 1, in <module>MemoryError: memory allocation failed, allocating 342 byte>>> micropython.mem_info(1)stack: 540 out of 7936GC: total: 166016, used: 44352, free: 121664 No. of 1-blocks: 39, 2-blocks: 12, max blk sz: 2048, max free sz: 2306GC memory layout; from 200083d0:00000: h=MhhhhhDAhhB..Dhh.DBDBh===B.B=.h====B=BBBBB.B=B.B=BBB.B=hB.B=Bh...
Even more, the memory map (or whatever it is) ends with the following:
Code:
1f800: ======.......................................................... (35 lines all free)28800: ........
Statistics: Posted by pico_nub_qq — Wed Jan 15, 2025 10:02 pm