Re: COM Interop and memory leaks

From: Robert Jordan (robertj_at_gmx.net)
Date: 08/30/04

  • Next message: Antonin Hofmann: ".NET and COM Connection Point problem"
    Date: Mon, 30 Aug 2004 09:42:28 +0200
    
    

    Hi Dmitry,

    > Hi
    >
    > Thanks for replying. As I understand, I must use COM+ object pooling through
    > inheritance from ServiceComponent and enabling pooling through corresponding
    > attributes. Then handler instances in pool will be deactivated when IE
    > control releases references. But how RegisterNamespace will get to know that
    > handler uses pooling? And which locking issues I can encounter?

    No, with managed object pooling I mean you have to do your
    own pooling of protocol handler instances. Just to avoid
    the creation of "unlimited" instances.

    Bye
    Rob

    >
    > --
    > With best regards, Dmitry
    > "Robert Jordan" <robertj@gmx.net> ???????/???????? ? ???????? ?????????:
    > news:cgugnf$ukm$04$1@news.t-online.com...
    >
    >>Hi Dmitry,
    >>
    >>
    >>>I wrote an asynchronous protocol handler in VB.NET. Another my program
    >
    > in
    >
    >>>VB.NET installs it as temporary handler, creates forms with WebBrowser
    >>>control, and navigates to URI's handled by my handler. I encountered
    >>>continuous memory leaks while navigating to pages. After investigation
    >
    > with
    >
    >>>SOS and memory profiler I discovered that instances of my protocol
    >
    > handler
    >
    >>>class is creating at every request to a page or embedded element on it,
    >
    > but
    >
    >>>freed only at program termination!
    >>
    >>I assume you register the protocol handler with CoInternetSession's
    >>RegisterNameSpace. RegisterNameSpace expects a IClassFactory, so
    >>you're able to control the object creation. you can, for example,
    >>use a managed object pool However, you'll have to deal with locking
    >>in this case.
    >>
    >>Bye
    >>Rob
    >
    >
    >


  • Next message: Antonin Hofmann: ".NET and COM Connection Point problem"

    Relevant Pages

    • Re: COM Interop and memory leaks
      ... I must use COM+ object pooling through ... Then handler instances in pool will be deactivated when IE ... > RegisterNameSpace. ...
      (microsoft.public.dotnet.framework.interop)
    • Re: Stateless objects
      ... If you are using pooling, the client may get a recycled instance - thus, it is your duty to clear all member variables when implementing IObjectControl to avoid another client retrieving a 'dirty' object. ... If I have a class installed in COM+, which has class level private variables, can the values be exposed to other users of the class if object pooling is not enabled. ... If UserB is using the same class is there a danger that UserB will be using values set by UserA or do they instantiate their own instance of the class. ...
      (microsoft.public.dotnet.framework.component_services)
    • Re: COM Interop and memory leaks
      ... When I implemented custom class factory for my handler ... I must use COM+ object pooling ... >>>>I wrote an asynchronous protocol handler in VB.NET. ...
      (microsoft.public.dotnet.framework.interop)
    • Re: New Object Pooling project
      ... >I've released a beta of my Object Pooling software and it's freely available ... >This is an extensible Object Pooling system that could be extendend to ... PoolingDataSource dataSource ...
      (comp.lang.java.softwaretools)