Solved! Go to Solution.
Have you tried trouble shooting the issue by monitoring the memory usage in taskmgr while stepping through each statement of your code?
Was this before you added all the ComReleaser stuff? It seems weird that you are creating an object in the main loop and releasing it in a sub function. Maybe create the feature cursor object in GetLargestAdjacent() and then force garbage collection in the main loop using this code:GC.Collect() GC.WaitForPendingFinalizers()
More information on the GC class here:
http://msdn.microsoft.com/en-us/library/system.gc.aspx
I would get rid of using the ComReleaser altogether. Here is the proper way to get a cursor and loop through it as well as clean up the objects that it uses:
Neil, why do you suggest not using ComReleaser?
According to the documentation, the ComReleaser doesn't actually clean anything up until the object reference goes out of scope