Dispose calling GC.Collect? Framework 1.0

  • Thread starter Thread starter Eric Cadwell
  • Start date Start date
E

Eric Cadwell

Does anyone know of any case in which the CLR explicitly calls GC.Collect? I
have a form that when unloaded, shows # of induced GC's incremented by 5.
This is killing performance.

I have a feeling that it's related to calling Dispose on a particular
control class like DataGrid, ListView, etc.

TIA,
Eric
 
Eric,

The CLR can collect at any time. I think what you meant to say was does
anyone know a case where a class in the framework calls GC.Collect? I think
that there are some that do this (especially ones that are using COM
interop), but I would not say that it is outside the realm of possibility
that it could be calling this.

Hope this helps.
 
Yes that is what I was fishing for, but it appears that it may not be
related to calling Dispose. In fact it is happening during the load of my
form!

Performance Monitor is showing an increase in # of induced GC of 6 per load
of a single form in my application. I have no explicit calls to GC in my
code.

Thanks,
-Eric


Nicholas Paldino said:
Eric,

The CLR can collect at any time. I think what you meant to say was does
anyone know a case where a class in the framework calls GC.Collect? I think
that there are some that do this (especially ones that are using COM
interop), but I would not say that it is outside the realm of possibility
that it could be calling this.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- nick(dot)paldino=at=exisconsulting<dot>com

Eric Cadwell said:
Does anyone know of any case in which the CLR explicitly calls
GC.Collect?
I
have a form that when unloaded, shows # of induced GC's incremented by 5.
This is killing performance.

I have a feeling that it's related to calling Dispose on a particular
control class like DataGrid, ListView, etc.

TIA,
Eric
 
Back
Top