Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / May 2004

Tip: Looking for answers? Try searching our database.

Leak in COM object

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
psn.net - 25 May 2004 10:31 GMT
Hi,
I am calling a third party COM object from a .NET application where I am
experiencing a memory leak. I tried the same set of calls to the COM object
from a VB6 application but found no leaks. In the .NET application, I have
the following set of operations:
- Create an instance of the RCW
- Make a series of calls
- Marshal.ReleaseComObject on the instance
- Set the instance to null
- GC.Collect() and GC.WaitForPendingFinalizers()

Any inputs?

-psn
SPG - 25 May 2004 12:15 GMT
HI,

I too am finding something similar is happening to our app.
However, Ours seems to run fine in Windows App mode, but when as a service,
It leaks like a rust bucket! (Aprox 8bytes per event I think).

We use an ActiveX DLL that we create a COM object from, this inturn passes
us events.. Sounds too easy!

Any ideas?
> Hi,
> I am calling a third party COM object from a .NET application where I am
[quoted text clipped - 10 lines]
>
> -psn
psn.net - 25 May 2004 12:53 GMT
Exactly, a windows app works fine. However, we do not have any events in our
application. We are using .NET Framework v1.0.

-psn

> HI,
>
[quoted text clipped - 21 lines]
> >
> > -psn
SPG - 25 May 2004 13:53 GMT
Hi,

I actually am beginning to think it is a bug int he interop layer.
Once UI read this post, I then created a simple app/service that creates
1000s of COM objects, releasing them each time.

Guess what? The win app works fine, the Service consumes like a tramp with a
bottle of meths!

So, where do we go from here?

Steve

> Exactly, a windows app works fine. However, we do not have any events in our
> application. We are using .NET Framework v1.0.
[quoted text clipped - 28 lines]
> > >
> > > -psn
psn.net - 25 May 2004 14:35 GMT
Steve,
So which version of the framework are you using? I was wondering whether
moving to 1.1 would make a difference in my case. Also, can you post your
test app?

-psn

> Hi,
>
[quoted text clipped - 44 lines]
> > > >
> > > > -psn
Gareth - 25 May 2004 14:59 GMT
We had a similar problem here and i read a while ago that it's a bug with
com interop and .net.

Set the Main method attribute to [MTAThread()]
(it worked for us...)

hope this helps.....

Gareth

> Steve,
> So which version of the framework are you using? I was wondering whether
[quoted text clipped - 54 lines]
> > > > >
> > > > > -psn
psn.net - 25 May 2004 17:42 GMT
Do we have a corresponding solution if we are running the application as a
service or calling the COM object through ASP.NET app?

-psn

> We had a similar problem here and i read a while ago that it's a bug with
> com interop and .net.
[quoted text clipped - 69 lines]
> > > > > >
> > > > > > -psn
Gareth - 28 May 2004 06:33 GMT
Not too sure how to make ASP.NET run under a different COM threading model.

sorry
Gareth

> Do we have a corresponding solution if we are running the application as a
> service or calling the COM object through ASP.NET app?
[quoted text clipped - 81 lines]
> > > > > > >
> > > > > > > -psn
psn.net - 28 May 2004 11:01 GMT
That's fine. Thaks for your solution. It seems to be working at least for my
service. I wonder whether ASP.NET, by default, runs in Multi-threaded
apartment model.

-pranav

> Not too sure how to make ASP.NET run under a different COM threading model.
>
[quoted text clipped - 91 lines]
> > > > > > > >
> > > > > > > > -psn
SPG - 28 May 2004 17:40 GMT
JSPs allow you to set the threading model in the page declarations.
There must be some form of directive in ASP.NET to do the same???
> Not too sure how to make ASP.NET run under a different COM threading model.
>
[quoted text clipped - 91 lines]
> > > > > > > >
> > > > > > > > -psn
SPG - 25 May 2004 18:01 GMT
Seems to work for me..
Am going to test overnight and then post my working and not working
solutions!

Cheers

Steve
> We had a similar problem here and i read a while ago that it's a bug with
> com interop and .net.
[quoted text clipped - 69 lines]
> > > > > >
> > > > > > -psn
SPG - 25 May 2004 15:22 GMT
Hi PSN,

We are using 1.1. Did not help!
Will have a go at Gareth's solution now.

If all fails will post my test app code..

Steve

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.