1. A method operating on a computing device, comprising: executing a session of an application in a single thread on a logic device, the application creating a managed proxy object that creates an unmanaged object in a memory; adding a node to a collection, where the node comprises a reference to the managed proxy object and a reference to the unmanaged object; maintaining a count of the number of nodes in the collection; reference counting the unmanaged object; collecting the managed proxy object by setting the managed proxy object in the node of the unmanaged object to point to null when the reference count of the unmanaged object becomes zero; traversing the collection when the count of the number of nodes exceeds a first specified number; and freeing an unmanaged object from the memory when the managed proxy object in the same node as the unmanaged object has been collected.
4. The method of claim 1 , comprising: determining the percentage of nodes removed from the collection after traversing the collection; increasing the first specified number when the percentage is smaller than a first specified percentage; and decreasing the first specified number when the percentage is larger than a second specified percentage.