You may know that in the old ASP, you can still write some object-based Program . However, you may have some questions about the object's survival.
Constructor & destructor
Class someclass
Private Sub Class_initialize
End sub
Private Sub Class_terminate
End sub
End Class
Print a string in the destructor to confirm the object's survival.
Set someobject = nothing
In this way, the name someobject bound to an object is freed from this object and becomes an unbound name. But it does not necessarily mean that the bound object will be released. If
Set someobject1 = new csomeclass
Set someobject2 = someobject1
Set someobject1 = nothing
In this way, the object will not be parsed. Because someobject2 is still bound to the object, that is to say, the two names are actually bound to the same object.
Page ends
Objects without manual release are automatically released at the end of page execution.
Local object
Objects generated in sub and function are automatically released at the end of the process if they are not returned as return values and the return values are bound with names.