How to release COM objects from VMs before restart to avoid memory leak?

Hello All,
I am facing issue with memory leak .With some research found out that unreleased COM objects might be one of the reason. Can anyone please suggest a method to fetch all active objects and release it at once?
Or did anyone face this memory leak issue but for a different reason?