Attempted to run the code and this message popped up:
MemoryError: memory allocation failed, allocating %u bytes
What does this mean?
Attempted to run the code and this message popped up:
MemoryError: memory allocation failed, allocating %u bytes
What does this mean?
It means you ran out of memory, probably the Python code is too big.
How many lines can the brain handle?
It’s not as simple as that
IIRC, source code size needs to be below 32k, but then the Python VM needs to be able to turn that into byte code, so program complexity also is a factor.
This is one of the big downsides to using Python (which blocks converts to) rather than C on the IQ generation 2 brain.
send feedback with the program open and I can take a look if you want me to.
discussion about this a couple of years ago.
Do I just screenshot the code?
No, use the feedback button in VEXcode (top right) to send feedback to VEX.
yea, program is too big and too complex for the Python VM
@bob2 I would love to know what you are doing to exceed the memory amounts.
@jpearman Is the heap management available to V2 users?
It was a really big block program generating > 32k of Python code. It also ran out of memory when trying to compile.
The problem is that IQ2 has (relatively) little memory, I can only set the heap size at 56k, yes the garbage collection is available to use, but the problem with really big programs is that there’s not enough heap to even compile them to byte code. This was all good for V5 (1MB heap) and EXP within reason (368k), but it’s not ideal on IQ2, I have no good solution that doesn’t involve converting to byte code externally and running that (which I could do at one point but the capability may have been removed).
I could run bob2’s code easily when converted to C++, but it’s a one way process and would be a bit awkward to keep editing in blocks and converting to a C++ project for download (with the risk of accidentally loosing the blocks project)
I’d guess that a restructure would help. Anytime you get that much in if then else blocks, it screams for functions. And there are ways to push the way functions store data. But that may be well above their skill level.
Two weeks ago I would have offered to see if I could do a quick refactor. But Friday is the first of 11 back to back Friday or Saturday events, so I’m swamped.
Thanks James for the response.
Redone, it works under the memory limit now