FREEMEM is a read-only system variable, which is described in the built-in help file of SmileBasic V2 as "Remaining memory available to user". However, a quick test in interactive mode shows that it gives no indication that an
Out of memory error is imminent:
OK CLEAR:DIM A(100000):?FREEMEM 1024 OK DIM B(100000):?FREEMEM 1024 OK DIM C(62145) Out of memory (DIM) OK DIM C(62144):?FREEMEM 1024 OK DIM D(1) Out of memory (DIM)
More correct to say that it is "Remaining program memory available to user". It is in units of 512 characters, apparently; after typing
FREEMEM has the value of 1024, and the largest program that can fit in SmileBasic V2 memory is 524288 characters long (including the end-of-line characters), and 524288/1024 is 512 exactly.