Book a Demo

Author Topic: Custom view memory leak?  (Read 2944 times)

lubos

  • EA User
  • **
  • Posts: 101
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Custom view memory leak?
« on: August 06, 2009, 07:44:03 pm »
I have created a custom view (C#). All is working well, but when I analyze the running EA using .NET memory profiler  I can see that instances of the UserControl component are still instanciated (as many times as the custom view was opened) even when the all customs views are already closed.
I'm not very advaced in .NET and C# issues, so do I something wrong or can this be a bug in EA?

Thanks for any hints

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Custom view memory leak?
« Reply #1 on: August 06, 2009, 08:57:15 pm »
EA is a COM application; it does not run as managed code.

COM objects are not (always) automatically disposed of by .Net. You may have to explicitly set them to null to force them to be collected. See as well the note regarding .Net garbage collection, buried somewhere in the API documentation.
No, you can't have it!

lubos

  • EA User
  • **
  • Posts: 101
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Custom view memory leak?
« Reply #2 on: August 07, 2009, 12:40:47 am »
Yes, I do setting to null or explicitly calling dispose in other cases. But I'm not sure if there is an API to "catch" the event of closing the customview  to dispose the corresponding object or even to recognize which custom view object belongs to which view.

But since I don't have any problems with it, I believe EA handles it good :-)

BTW  
The reason why I was doing the investigation of running instances was I have a problem with MS Word. I call MS Word from my plugin and everything seems to work.
But sometimes Word freezes (it writes a message that some error arised -- it really doesn't say which one).This happens even when the functionality of the plugin  was not used and the word was started normally from windows start menu .... there is just EA with the plugin enabled running.  I still can't find the problem..


Thanks