• Welcome to Valhalla Legends Archive.
 

[SOLVED] Correctly freeing an object

Started by l2k-Shadow, September 22, 2006, 08:47 PM

Previous topic - Next topic

l2k-Shadow

Let's say I'm trying to access an ActiveX .dll using this code

Dim obj as Object
     Set obj = CreateObject("Project1.Class1")
     obj.HelloWorld

now how can I properly free this object?

Set obj = Nothing

is not doing it.

Unload obj

cannot be done
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

RealityRipple

IIRC, VB6 automatically unloads objects when the form they're on (or the sub/function they're in) are unloaded (or completed).

l2k-Shadow

Well I have the object loaded in a public variable to do things with it throughout the program until I need to unload it, and I just want to unload that object, not the entire program.
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

RealityRipple

Ah... I'm not sure you can do that... Try creating a form that acts as the holder of the object, and then Loading/Unloading the form when you want to load/unload the object. Remember to Set Form1 = Nothing when you unload.

l2k-Shadow

Quote from: RealityRipple on September 22, 2006, 09:51 PM
Ah... I'm not sure you can do that... Try creating a form that acts as the holder of the object, and then Loading/Unloading the form when you want to load/unload the object. Remember to Set Form1 = Nothing when you unload.

i'd rather not unload it than do something so lame.
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

Cat Food

I have a great quote of some newb saying someone was an idiot because of a memory leak in their application, and that they didn't know how to unload objects when finishing the use of them. When infact there was no memory leak involved in the program.

Oh wait...that newb was.... ---THIS ARROW POINTS UP---^

Stealth

Set obj = Nothing has worked for me in the past.. where have you seen a problem with it?
- Stealth
Author of StealthBot

l2k-Shadow

Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.