Code Camp: COM Interop
This was probably the most in depth of the presentations that I attended. Sam Gentile did an excellent job of introducing the subject.
There are some major incongruities between the COM and .Net programming models. The most serious of these is over life time issues and the garbage collector. .Net must be able to decrement reference counts other than just at finalization time. IDisposable is the obvious choice for this but it is unclear to me why the Interop Wrappers do not support this. The general message was that if you want it to work right you have to dig in a little deeper.
I actually have personal experience of this. I was playing with some images that were stored in a COM object. They were using a significant amount of memory. They would go away when the GC fired but the GC was never firing because the managed heap was only a few hundred bytes and the COM heap was hundreds of megabytes..
There are some major incongruities between the COM and .Net programming models. The most serious of these is over life time issues and the garbage collector. .Net must be able to decrement reference counts other than just at finalization time. IDisposable is the obvious choice for this but it is unclear to me why the Interop Wrappers do not support this. The general message was that if you want it to work right you have to dig in a little deeper.
I actually have personal experience of this. I was playing with some images that were stored in a COM object. They were using a significant amount of memory. They would go away when the GC fired but the GC was never firing because the managed heap was only a few hundred bytes and the COM heap was hundreds of megabytes..
0 Comments:
Post a Comment
<< Home