COM works with reference counting (so does perl). That is
usually good. It turns bad if your objects reference its
parent. Then neither one will be deleted. Even FreeUnusedLibraries() doesn't help (mind the 'unused' in the name) because they are considered used by the other object. Because many COM-objects need to know their parent,
they have a Set...Site() function (mostly the parent is called somthingSite in COM). Before unreferencing, you should call this with a NULL-Pointer, if you called it before to set a Site. Even if the function is called by another name, I would check for retained references.