Contributions to this software library are always welcome. Please ensure that you post program listings rather than .raw files. They give a reasonable idea of what your program does without having to load them into a DM42 and you can also include comments in your code. Check out the following link for a decoder/encoder: https://technical.swissmicros.com/decoders/dm42/
You can then copy/paste the listing and post it in "code" tags.
RTN will clear the return stack, which includes all local variables. That should free up all the memory that was allocated by a recursive function.
There's no garbage collector in Free42, and none is needed, since objects are freed immediately when they are deleted using CLP, CLV, CLST, and RTN.
OK.
The same Ack call on the iphone gives another error : "RTN stack full", then MEM give the same value as before, as you explain.
On the DM42 this is different, memory doesn't come back to the previous value after a Ack(4,1).
Before reloading a state (to get it fresh cleaned...), I just saved one State, and just after this, a MEM give me 71528 bytes back (I was blocked around 58976). Very strange ! It's like the State Save command had clean the memory garbage.
--- Olivier
48GX, Prime G2, 50G, DM15L, DM42, 28S, HP 15c CE
RTN will clear the return stack, which includes all local variables. That should free up all the memory that was allocated by a recursive function.
There's no garbage collector in Free42, and none is needed, since objects are freed immediately when they are deleted using CLP, CLV, CLST, and RTN.
OK.
The same Ack call on the iphone gives another error : "RTN stack full", then MEM give the same value as before, as you explain.
That's normal; calculating ack(4, 1) requires a maximum stack depth of 65536 levels, and the stack in Free42 is limited to 1024. The DM42 runs out of memory before reaching the maximum stack depth, which is why you get a different error message there.
On the DM42 this is different, memory doesn't come back to the previous value after a Ack(4,1).
Before reloading a state (to get it fresh cleaned...), I just saved one State, and just after this, a MEM give me 71528 bytes back (I was blocked around 58976). Very strange ! It's like the State Save command had clean the memory garbage.