If, as part of our ASP.NET code, we create references to COM objects, do the (native) allocation of memory for these com objects get counted under the aspnet_wp process ?? Or are they going to be counted under, for instance InetInfo ?
Answer:Yes they are counted under the ASPNET_WP process in Win2K. You can dispose of your RCW wrapped objects by calling ReleaseComObject however don’t call this more than once as you will get a disconnected error. If what you suspect is true this will not be the root cause of your memory problem. The ASP.NET process will garbage collect under memory pressure and it wrapped COM objects are released when their wrapper is GC’d. Hence you can’t actually run out of memory just because these things are kept around longer than you expect them to.
2) If you are a client application using a modest number of COM objects that are passed around freely in your managed code, you should not use ReleaseComObject. You would likely inflict Disconnected errors on parts of the application by doing so. The performance benefit of eagerly cleaning up the resources isn’t worth the problems you are causing.
3) If you have a case where you are creating COM objects at a high rate, passing them around freely, choking the Finalizer thread, and consuming a lot of unmanaged resources… There’s no good solution, redesign.
This posting is provided “AS IS” with no warranties, and confers no rights.