I found this interesting little issue while working on a program that processes *potentially* large dynamic data sets.
Most of us here are probably familiar with the limit on array sizes being 2^31 depending on available memory. Well I barely even scratched the surface of that with my program (600^2), but I was getting out of memory errors.
My original loop looked liked the following.
WHILE RUNNING VSYNC 'Call drawing function 'Call input function WENDHowever after I changed the type of loop that was used, the error went away.
@MAIN VSYNC 'Call drawing function 'Call input function IF RUNNING GOTO @MAINThis brings me to the conclusion that garbage collection is only properly handled when control belongs to the main thread. Does anyone else get this error? You can try experimenting with the following code. If you really get an out of memory error then FREEMEM should be close/equal to zero.
VAR I DIM ARR[0] WHILE 1 INC I PRINT I ARR=RESIZEM(I*I) WEND DEF RESIZEM(NS) DIM TMP[NS] RETURN TMP END