I wrote an addin for ArcCatalog that generates thumbnails, but it keeps running out of memory. Basically, it works by the user selecting an item in either the tree view or contents view then running the tool. It changes to the preview view, exports the ActiveView and updates the thumbnail with the export image.
It works fine for single items (feature classes, rasters, etc.), but when you select a geodatabase or folder, it creates thumbnails for every item within. I've done everything I can to dispose of COM objects, especially Graphics and Bitmap objects, but still run into problems after a few thousand thumbnails have been created.
I actually think the problem is just with ArcCatalog - if you manually select a lot of items, you can see the memory footprint increase (using your profiler of choice - Task Manager, Perfmon, etc.) and it is never released. Has anyone else seen this happen? And is there actually a better way to generate thumbnails using ArcObjects?
The addin is written in C#.NET and compiled at ArcGIS 10.0. I've run it on both 10.0 and 10.3 with the same results.