sinc
2004-09-18, 04:23 PM
There is a bug (probably in the VLISP/ActiveX bridging mechanism) that causes Autocad to become unstable if VLA-objects accessed through the ActiveX object model are not explicitly released. This means you can't use inline calls to Autocad entities in code like the following:
(vla-get-name (vla-item (vla-get-documents (vlax-get-acad-object)) myIndex))
This line of code does not maintain the reference to the various objects returned, so they cannot be explicitly released later. This may possibly be fixed by strategically-placed explicit calls to the garbage collector, but if so, this proceedure should be clearly documented.
At the very least, this bug should be noted in the documentation, in VERY CLEAR fashion, since it violates a central tenet of Lisp (that objects are garbage-collected, and do not need to be explicitly released). This bug has apparently existed ever since the introduction of VLISP, and it still isn't documented. I've found a lot of tales of woe caused by this bug...
(vla-get-name (vla-item (vla-get-documents (vlax-get-acad-object)) myIndex))
This line of code does not maintain the reference to the various objects returned, so they cannot be explicitly released later. This may possibly be fixed by strategically-placed explicit calls to the garbage collector, but if so, this proceedure should be clearly documented.
At the very least, this bug should be noted in the documentation, in VERY CLEAR fashion, since it violates a central tenet of Lisp (that objects are garbage-collected, and do not need to be explicitly released). This bug has apparently existed ever since the introduction of VLISP, and it still isn't documented. I've found a lot of tales of woe caused by this bug...