views:

340

answers:

5

I have the following Leak situation in a VB.NET (.NET2) application: a form - DetailTache (TaskDetails) - in my MDI application is not garbage collected is not collected ofter open/close.

I did the following profiling root:

alt text

any idea how this leak could be fixed? thanks.

EDIT:

Result search from projet of WinComboRowSelected Event. There are 3 usages of this word in application:

  1. Declaration in Class WinCombo: Event WinComboRowSelected(ByVal sender... (only one)
  2. Raising: RaiseEvent WinComboRowSelected(sender, (3 raisings)
  3. Usage: ...e As Keolis.ctlWinCombo.WinCombo.WinComboRowSelectedEventArgs) Handles cmbProduit1.WinComboRowSelected (multiple handles).

there is No other usage of this event.

If need other code details, please ask and I will post it.

A: 

Without your code it is hard to say how to fix the leak.

Remember what would make an item not garbage collected. If it still had a reference to the object.

I would look at your could and make sure all references are set to null when you expect it to be collected. If it is not being collected that means something still has a reference to it.

I would read this article for a better understanding of Garbage Collection.

David Basarab
the EventHandler s references, as we can see in my case, are not so evident to detect... I added some explanation in Edit.
serhio
A: 

Does your form have any event handlers that have not been unsubscribed? This would be the number one cause to controls not being garbage collected.

Make sure that the forms that subscribe to WinComboRowSelectedEvent also get unsubscribed before disposing of the form.

Oded
added some explanation about this event in edit
serhio
A: 

VMMap offers flexible views for memory analysis of live processes :

VMMap is a process virtual and physical memory analysis utility. It shows a breakdown of a process's committed virtual memory types as well as the amount of physical memory (working set) assigned by the operating system to those types. Besides graphical representations of memory usage, VMMap also shows summary information and a detailed process memory map. Powerful filtering and refresh capabilities allow you to identify the sources of process memory usage and the memory cost of application features.

gimel
It's a tool for analysing memory use - you have a memory leak. Join the dots.
Matt Ellen
in my case I used JetBrains dotTrace and also .NET Memory Profiler, can VMMap tell me more that I already have?
serhio
Sorry, serhio. I only know the link between your question and gimel's answer.
Matt Ellen
+3  A: 

The ToolTip that appears in the object tree looks significant to me. It probably wires a event handler for the RowSelected event so it can update the tip. Clearly you are using a 3rd party control, it smells like Infragistics. Not a company well known for the quality of its products. I'd further guess that the ToolTip is internal to its control and that you can't access it to forcibly unsubscribe the event handler. Beyond giving up on tool tips, if that's even possible, you can't do much but contact the vendor for support. Or ditch the control.

Hans Passant
:) as usual, you shoot in the right center(sorry for a so non-English translation). You have reason, the ToolTip seems to be significant, because I see same think on the other non-Disposed resources to passing from MDIMainForm via this strange ToolTip. We use a some 3rd party controls, one of them is Infragistics. More that that: `Public Class WinCombo Inherits Infragistics.Win.UltraWinGrid.UltraCombo`
serhio
Hmya, I don't understand why you don't disclose this kind of essential information. Spread over 4 threads, all about the same issue, you've wasted the time of about 15 contributors to this forum. Asking questions here seems to be some sort of game to you. The English term for that is "rep whoring", I don't know the French term for that. Anyhoo, ditch the control, Infragistics creates junk.
Hans Passant
@nobugz: First of all, thank you foe enlightening the problem. Now, you have no reason for critics. How could I know that **this** information were essential?! This was a really "discovery" for me that a 3rd control could cause this leack! Secondly, my other threads on the memory leak was not directly linked with this problem. by e.g. "How to remove handlers on a base form" is a general question, "can delegates cause memory leaks" was an other (already resolved) problem - I had a undisposed delegate and i have not it anymore, EventHandler and Memory Leaks is also a general question etc etc.
serhio
What about "rep whoring" or game, I will not comment it, just if you don't want to spend your time responding to questions, just don't do it, if you want complaining that I stole your time you are ridiculous. Do you really thing that I have no other things to do that posting "spam" and receive/give points?! And, finally, maybe I work on a French project, but this does not mean at all that I am a French man.
serhio
PS. Surely you downvoted the question because you know the forum rules and the question is "unclear or not useful", however you answered it in a glance and it really helped me.
serhio
A propos of problem: Maybe I can't breack the link between the Infragistic combo and its container form(DetailTache) bot what have MDIForm with the ComboBox on the DetailTache form?
serhio
A: 

As pointed out nobugs (thanks again), the problem really resided in the used 3rd party components - Infragistics.

As I find out later, Infragistics team decided to keep static references to all the added controls in memory in order to support such (secondary imho) effects as XP theme changes.

Really helpful on the problem was this article, the solution provided in witch replaced the kept in memory objects with WeakReferences, that can be collected by the GC.

Luckily we used a older version of Infragistics that in the article and the solution worked. It's a pity, however, that Infragistics does not plan to fix this bugs, even declared years ago.

serhio