01-01-2025, 10:36 AM
(01-01-2025, 10:27 AM)Jack Wrote:
Ok, I get what you are saying but it makes no sense, even if _MEM is a structure why is it not freed automatically just like a udt ?
Mem is set up very similar to OPEN file$ FOR BINARY..
Think of this:
Code: (Select All)
Do
foo
Loop Until _KeyHit
Sub foo
f = FreeFile
Open "temp.txt" For Binary As #f
Print f
End Sub
Now, without a CLOSE statement, the above is going to also be a memory leak. f is going to always increase handles for that file, and eventually you're going to run into issues somewhere.
Of course, it'll all close when the program closes, but if you want to prevent memory leaking, close it when you're done with it. There's no logic attached to do it automagically for you.