Garbage collection
- Last Updated: March 30, 2020
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
ABL developers are familiar with the use of the DELETE
OBJECT statement for destroying handle-based objects, such
as a widget, a procedure, a server, or a socket. Explicitly deleting class-based
objects is not necessary because of garbage collection. Class-based objects
are deleted during garbage collection when all references to that
object have been removed, that is, when its reference count goes
to zero.
As long as you need an object, you must ensure that you maintain an object reference to that object. You can always assign the object reference to another variable before it goes out of scope, or you can pass it to another procedure, where you can continue to manage the object until either you delete it or it is deleted by garbage collection.
Garbage collection does not delete a class-based object with
a circular reference. For example, Object A has a reference to Object
B and Object B has a reference to Object A. To delete an object
with a circular reference you must use the DELETE OBJECT statement.