Forum Discussion
Pakema
15 years agoContributor
Alexei, thanks
But I want know something else
Can anybody from AQA explain me about: How I can clean memory form object (f.e. set a = obj)(this is the main idea of this topic)? How work garbage collector in TC ? the same as in native VB or not?
As I know form msdn http://msdn.microsoft.com/en-us/library/0x9tb07z.aspx (It's about VB)
When you assign Nothing to an object variable, it no longer refers to any object instance. If the variable had previously referred to an instance, setting it to Nothing does not terminate the instance itself. The instance is terminated, and the memory and system resources associated with it are released, only after the garbage collector (GC) detects that there are no active references remaining.
The next things http://msdn.microsoft.com/en-us/library/55yzhfb2(v=vs.90).aspx (about Class Destructor Methods)
In Visual Basic 6.0, the Nothing keyword is used to disassociate an object variable from an actual object. The Set statement is used to assign Nothing to an object variable
And end from wiki http://en.wikipedia.org/wiki/Destructor_(computer_science)
...destructor (sometimes shortened to dtor) is a method which is automatically invoked when the object is destroyed. Its main purpose is to clean up and to free the resources (which includes closing database connections, releasing network resources, relinquishing resource locks, etc.)
thanks
But I want know something else
Can anybody from AQA explain me about: How I can clean memory form object (f.e. set a = obj)(this is the main idea of this topic)? How work garbage collector in TC ? the same as in native VB or not?
As I know form msdn http://msdn.microsoft.com/en-us/library/0x9tb07z.aspx (It's about VB)
When you assign Nothing to an object variable, it no longer refers to any object instance. If the variable had previously referred to an instance, setting it to Nothing does not terminate the instance itself. The instance is terminated, and the memory and system resources associated with it are released, only after the garbage collector (GC) detects that there are no active references remaining.
The next things http://msdn.microsoft.com/en-us/library/55yzhfb2(v=vs.90).aspx (about Class Destructor Methods)
In Visual Basic 6.0, the Nothing keyword is used to disassociate an object variable from an actual object. The Set statement is used to assign Nothing to an object variable
And end from wiki http://en.wikipedia.org/wiki/Destructor_(computer_science)
...destructor (sometimes shortened to dtor) is a method which is automatically invoked when the object is destroyed. Its main purpose is to clean up and to free the resources (which includes closing database connections, releasing network resources, relinquishing resource locks, etc.)
thanks