How do I really force a GC.Collect

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm having a problem when I perform merge replication with sqlce where I run
out of memory. This is only happening on one brand of pocket pc devices. It
seems like the merge replication is allocating memory faster than the device
can garbage collect. Because the application is in a non-interactive state
at the time this happens, it doesn't really matter how much processing time I
take cleaning the memory. A normal GC.Collect doesn't help any and from what
I understand the compact framework only clears the memory when it really
needs to. Thanks, Scott
 
I ran accross that this weekend when I was looking for information and just
reread it. So to clarify, there is no way to call
GC.Collect(GC.MaxGeneration) or the equivalent on the compact framework?
Also, can the device manufacturers change the GC settings on the image?
 
If you read the links you know that there are no generations so by
definition the answer is no to the first question and it is no for the
second question (unless you count the OEM settings as described on my blog).

Cheers
Daniel
 
A couple of links deep there is something that mentions generations and I
thought it was talking about the compact framework but I see it isn't. Do
you have any ideas as to what could cause the actual memory usage of my
application to be much larger on only a single model of devices? The memory
reported by GC.GetTotalMemory is the same. Thanks, Scott
 
Different versions of CF? Different applications running at the same time as
yours? Less memory on the device? Everything is a guess. If you read my blog
entry you'll find GlobalMemoryStatus and the performance counters. I suggest
using those tools to get accurate data rather than just "memory usage is
larger". Again following the links will tell you that e.g. putting your app
to the background forces a full GC.

Without specific data and code, I am not sure this thread will offer you
anything more than what is already on my memory FAQ. In your original post
you mentioned sqlce so you might want to try some searches on that to see if
there is anything specific to it (microsoft.public.sqlserver.ce).

Cheers
Daniel
 
If I adjust the available program memory to 18mb from 22mb everything works
just fine. I'll just make sure to do that. Thanks for your help, Scott
 
Back
Top