Releasing Objects and Freeing Memory
 
 
 

Just as you can have different variables pointing to the same AutoCAD entity, you can have multiple VLA-objects pointing to the same drawing object. You can compare two VLA-objects with the equal function, which returns T if both objects point to the same drawing object.

As long as a VLA-object points to a drawing object, AutoCAD will keep all the memory needed for the object. When you no longer need to reference an object, use the vlax-release-object function to indicate this to AutoCAD:

(vlax-release-object object)

After releasing an object, it is no longer accessible through the VLA-object pointer. This is similar to closing a file. No memory is necessarily freed when you issue vlax-release-object, but AutoCAD can reclaim the memory if needed, once all references to the object have been released.

To test whether or not an object has been released, use the vlax-object-released-p function:

(vlax-object-released-p object)

This function returns T if the object has been released, nil if it has not.