Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What unloads the modules when a vb6 program terminates

Tags:

vb6

The proper way to end a vb6 program is to do something like this :

Dim frm As Form
   For Each frm In Forms 
       Unload frm
   Next frm
   end

That takes care of forms, what takes care of modules in memory?

like image 712
kjack Avatar asked Jul 17 '26 00:07

kjack


2 Answers

There is no need to explicitly unload modules in VB6. They are unloaded automatically when the last form is unloaded. The language doesn't support references to standard modules at all, only to the (global) functions and variables defined therein. Since you can't reference the module, you can't unload them either.

like image 150
JeffK Avatar answered Jul 24 '26 13:07

JeffK


Don't use End, you don't need to (ever). Then all memory gets freed properly.

Even using End, memory should be freed automatically. There was a rumor that some class instances are forgotten and don't get terminated correctly, despite reference counting. Thus, it's been established as best practice to set all object instances to Nothing explicitly (especially, but not limited to instances allocated in modules). I've never seen any confirmation that this is actually true (it might still be, though!).

like image 27
Konrad Rudolph Avatar answered Jul 24 '26 11:07

Konrad Rudolph



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!