Welcome Guest. Please Login or Register. Apr 1st, 2018, 04:02am
ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018. We apologize Conforums does not have any export functions to migrate data. Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.
Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
Can jumping out of an error handler with a goto rather than a resume cause a memory leak or another downside?
It's possible, but not very likely. If you use an ON ERROR GOTO in a subroutine, function or loop (FOR, WHILE, DO) it is automatically cancelled (and the memory it used freed) on exit.
So the only circumstance when a memory leak could result is if the ON ERROR GOTO is used in the 'lowest level' of your program, when you aren't in a function or loop. In that case you should explicitly cancel the error trapping using:
Code:
ON ERROR GOTO 0
Of course if jumping out of the error handler also means you have jumped out of a loop then certainly there will be a memory leak, but that's not directly related to the error trapping.
The current version of LBB (2.86) displays the heap and stack usage in the debugger, so if you are worried about the possibility of a memory leak from this cause in your own program(s) you can check it.