Code:
while 1=1
//Do something
if X = 5
Return
End

Will this leak memory if I Return to parent program before reaching the end of the while loop?

Thanks,
Sirryan
I don't believe it will. I suppose it's because memory leaks are fixed whenever you exit from a program, perhaps it's because you used a Return statement rather than jumping out of the loop with a Goto.
I made a quick and dirty program to simulate you code and I haven't encountered any slowdown or memory errors yet. (counter was over 1500)

prgmA0

Code:
0->Y
Lbl 0
1+Y->Y
Disp Y
prgmA
Goto 1


prgmA

Code:
5->X
While 1
If X=5
Return
End
Yeah, using Return, iirc, will NOT do any mem leaks, however, it is Lbl/ Goto that does.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement