For example, after calling CShapefile::get_Shape method, the caller is responsible to release the COM interface returned by the method. Somthing like this:
Shape shape = shapeFile.Get_Shape(0);
// Do something on shape interface
Now my question is:
Is it obligatory or optional to release a COM interface explicitly?
Does CLR/GC do that for us in COM wrapper (the auto-generated interop assembly for COM)?
As far as I know, .NET does this work or otherwise we would end up with huge memory leaks. It's easy to test: write C# procedure, create instance of shapefile, don't release it explicitly. Then start debug session of ocx, call the procedure and see whether destructor of the Shapefile class was called (or even track down underlying COM code to releasing the pointer).