Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
CaptainBoing Guru Joined: 07/09/2016 Location: United KingdomPosts: 2170
Posted: 06:29am 28 Apr 2017
Copy link to clipboard
Print this post
This is MMBasic 5.3 on both MZ and MX processor.
The NEW command seems to clear variables but does not de-allocate the space.
What am I missing?
Justplayin Guru Joined: 31/01/2014 Location: United StatesPosts: 327
Posted: 06:36am 28 Apr 2017
Copy link to clipboard
Print this post
I believe you re-allocated memory when you printed the variable a to show it had been cleared. Try using MEMORY immediately after doing a NEW instead.
Unfortunately I don't have a 'mite handy to test with at the moment.
--CurtisI am not a Mad Scientist... It makes me happy inventing new ways to take over the world!!
CaptainBoing Guru Joined: 07/09/2016 Location: United KingdomPosts: 2170
Posted: 06:37am 28 Apr 2017
Copy link to clipboard
Print this post
heh! you passed the test
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2933
Posted: 06:39am 28 Apr 2017
Copy link to clipboard
Print this post
This is correct! It has thrown me a few times too
To see this affect - type a few more PRINT x statements (replacing x with different 'made up' variable names) and then type MEMORY again. You will see the variable count increase for each unique variable you just typed PRINT x for.