Orphaned Objects
This leaves objects in memory and eventually you will run out of memory.
You should add a class method called "Clean" to your class that cleans up any internal pointers (or references) before explicitly destroying the object references.
You should then always call this method before destroying a reference to an instance of the class.
Class - myClass
Private _objectLink As myClass
Public Get Property_Link() As myClass
Set Property_Link = _objectLink
End Sub
Public Set Property_Link(MyObject As myClass)
Set _objectLink = MyObject
End Sub
Public Sub Method_Clean()
Set _objectLink = Nothing
End Sub
Dim object1 As myClass
Dim object2 As myClass
Set object1 = New myClass
Set object2 = New myClass
object1.Link = object2
object2.Link = object1
object1.Method_Clean
object2.Method_Clean
Set object1 = New Nothing
Set object2 = New Nothing
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrev