PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Compact Framework GC.Collect() not cleaning memory, how to find out what references to lots of memory still exist?

Reply

GC.Collect() not cleaning memory, how to find out what references to lots of memory still exist?

 
Thread Tools Rate Thread
Old 15-04-2008, 10:03 PM   #1
DR
Guest
 
Posts: n/a
Default GC.Collect() not cleaning memory, how to find out what references to lots of memory still exist?


GC.Collect() not cleaning memory, how to find out what references to lots of
memory still exist?

When all my processign is done i set everything to null and then:
GC.Collect();
and then
GC.WaitForPendingFinalizers();
but it still shows that my process takes 400 MB of memory. Is there any easy
way to see what references that I forgot to set to null so that the memory
cleas up on GC.Collect() ?


  Reply With Quote
Old 15-04-2008, 11:20 PM   #2
Chris Tacke, eMVP
Guest
 
Posts: n/a
Default Re: GC.Collect() not cleaning memory, how to find out what references to lots of memory still exist?

If you're running CF 3.5 you can use the profiler, which is part of the
Remote Performance Monitor.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com

"DR" <softwareengineer98037@yahoo.com> wrote in message
news:OZA93D0nIHA.2292@TK2MSFTNGP03.phx.gbl...
> GC.Collect() not cleaning memory, how to find out what references to lots
> of memory still exist?
>
> When all my processign is done i set everything to null and then:
> GC.Collect();
> and then
> GC.WaitForPendingFinalizers();
> but it still shows that my process takes 400 MB of memory. Is there any
> easy way to see what references that I forgot to set to null so that the
> memory cleas up on GC.Collect() ?
>



  Reply With Quote
Old 16-04-2008, 01:32 AM   #3
Germán Schuager
Guest
 
Posts: n/a
Default Re: GC.Collect() not cleaning memory, how to find out what referencesto lots of memory still exist?

If you are using CF 2 like I do, you can retarget your application to
run on the full framework and then use the Profiler for the full
framework.

Besides, I think that setting all the references to null is not
enough... you should call Dispose() where it is requiered (i.e.
Bitmaps).

On 15 abr, 19:20, "Chris Tacke, eMVP" <ctacke.at.opennetcf.dot.com>
wrote:
> If you're running CF 3.5 you can use the profiler, which is part of the
> Remote Performance Monitor.
>
> --
>
> Chris Tacke, Embedded MVP
> OpenNETCF Consulting
> Giving back to the embedded communityhttp://community.OpenNETCF.com
>
> "DR" <softwareengineer98...@yahoo.com> wrote in message
>
> news:OZA93D0nIHA.2292@TK2MSFTNGP03.phx.gbl...> GC.Collect() not cleaning memory, how to find out what references to lots
> > of memory still exist?

>
> > When all my processign is done i set everything to null and then:
> > GC.Collect();
> > and then
> > GC.WaitForPendingFinalizers();
> > but it still shows that my process takes 400 MB of memory. Is there any
> > easy way to see what references that I forgot to set to null so that the
> > memory cleas up on GC.Collect() ?


  Reply With Quote
Old 17-04-2008, 04:13 AM   #4
Simon Hart [MVP]
Guest
 
Posts: n/a
Default RE: GC.Collect() not cleaning memory, how to find out what references

It is always bad design to call the garbage collector to explicitly clean up.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


"DR" wrote:

> GC.Collect() not cleaning memory, how to find out what references to lots of
> memory still exist?
>
> When all my processign is done i set everything to null and then:
> GC.Collect();
> and then
> GC.WaitForPendingFinalizers();
> but it still shows that my process takes 400 MB of memory. Is there any easy
> way to see what references that I forgot to set to null so that the memory
> cleas up on GC.Collect() ?
>
>
>

  Reply With Quote
Old 17-04-2008, 05:01 PM   #5
Chris Tacke, eMVP
Guest
 
Posts: n/a
Default Re: GC.Collect() not cleaning memory, how to find out what references

I wouldn't go that far. "Always" is too strong a statement. It is rarely
good design, but not *always* bad.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com

"Simon Hart [MVP]" <srhartone@yahoo.com> wrote in message
news:62E6D9EF-BE7A-45C0-8C07-CA573B0A0848@microsoft.com...
> It is always bad design to call the garbage collector to explicitly clean
> up.
> --
> Simon Hart
> Visual Developer - Device Application Development MVP
> http://simonrhart.blogspot.com
>
>
> "DR" wrote:
>
>> GC.Collect() not cleaning memory, how to find out what references to lots
>> of
>> memory still exist?
>>
>> When all my processign is done i set everything to null and then:
>> GC.Collect();
>> and then
>> GC.WaitForPendingFinalizers();
>> but it still shows that my process takes 400 MB of memory. Is there any
>> easy
>> way to see what references that I forgot to set to null so that the
>> memory
>> cleas up on GC.Collect() ?
>>
>>
>>



  Reply With Quote
Old 19-04-2008, 02:14 AM   #6
Simon Hart [MVP]
Guest
 
Posts: n/a
Default Re: GC.Collect() not cleaning memory, how to find out what referen

That's a fair comment.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


"Chris Tacke, eMVP" wrote:

> I wouldn't go that far. "Always" is too strong a statement. It is rarely
> good design, but not *always* bad.
>
>
> --
>
> Chris Tacke, Embedded MVP
> OpenNETCF Consulting
> Giving back to the embedded community
> http://community.OpenNETCF.com
>
> "Simon Hart [MVP]" <srhartone@yahoo.com> wrote in message
> news:62E6D9EF-BE7A-45C0-8C07-CA573B0A0848@microsoft.com...
> > It is always bad design to call the garbage collector to explicitly clean
> > up.
> > --
> > Simon Hart
> > Visual Developer - Device Application Development MVP
> > http://simonrhart.blogspot.com
> >
> >
> > "DR" wrote:
> >
> >> GC.Collect() not cleaning memory, how to find out what references to lots
> >> of
> >> memory still exist?
> >>
> >> When all my processign is done i set everything to null and then:
> >> GC.Collect();
> >> and then
> >> GC.WaitForPendingFinalizers();
> >> but it still shows that my process takes 400 MB of memory. Is there any
> >> easy
> >> way to see what references that I forgot to set to null so that the
> >> memory
> >> cleas up on GC.Collect() ?
> >>
> >>
> >>

>
>
>

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off