Now, the document collection and the application will always be referenced so it doesn't matter that they can't be cleaned up but if you go further down the hierarchy than you may lock objects that otherwise were up for garbage collection (and global/local referencing is indifferent to this).
As mentioned previously, with in-process objects it may not be a problem at all but just to know that there may be a problem and that it's not documented .. well, that sucks.
I have confirmed that there is a definite bug in here. Normal objects seem fine, but distributed objects (ActiveX) are definitely buggy.
At this point, I'm not familiar enough with ActiveX to be sure if the problem is an ActiveX problem, or a problem in Autodesk's VLisp/VBA bridge, or something else. Right now, I suspect the VLisp/VBA bridge, since not releasing the acad object doesn't cause a problem. The vlax-get-acadObject method is probably hard-coded in a way that bypasses the general bridging mechanism, thereby bypassing the bug.
I'll let you know if I figure out anything else useful, but to be safe, I guess the only thing to do is to vla-release all vla-objects. This is annoying, like Stig says, since not only does it mean you have to include a lot of otherwise unnecessary vla-release-object lines, it also means you can't inline vla- commands; in other words,
<plain english translation>
DON'T use constructs like:
(vla-get-name (vla-item (vla-get-documents (vlax-get-acad-object)) myIndex))
</plain english translation>
Instead, you have to assign the result of each vla- command to a local variable, so you can vla-release it later. Blech! :fart:
This is DEFINITELY something that should be in the documentation, in multiple places, underlined, in capital letters, quotated, with circles and arrows...