Re: Garbage collector behavior
- From: "<ctacke/>" <ctacke[at]opennetcf[dot]com>
- Date: Wed, 1 Aug 2007 15:27:30 -0500
Your understanding is accurate. No idea if that's how the desktop framework
works - I've not researched it nearly as much as I have the CF.
--
Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com
"Vinz" <Vinz@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:27647BE8-4B0F-4FEE-B576-5752E0D1B71F@xxxxxxxxxxxxxxxx
Thanks a lot Chris,
From what I understand, if a finalizer is defined, when the object is not
used anymore (=null or out of scope) at the next collection the finaliser
is
added to the list of finaliser to execute, then when the finaliser is
done,
the next collection will free the object from the managed heap. So it
actually need more than one collection to free it from the managed heap.
If there is no finaliser the object is removed from the managed heap at
the
next collection.
What I'm not sure is when do the managed heap shrink? What I understand is
that EACH time the collection ends if there is more than 750k of free
memory
in the managed heap there is a compaction. Then after each compaction, if
there is more thant 1 MB of free memory in the heap, the virtal memory is
given back to the OS by blocks of 1 MB.
Of course you can correct me if I'm wrong. Is this also the behavior of
the
.NET framework or is it only for .NET CF?
"<ctacke/>" wrote:
The finalizer running has no direct relevence on the available system
memory. GC Collection is where any actual actiuon might (or might not)
occurr.
See this WebCast:
http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?culture=en-US&EventID=1032318791&CountryCode=US
--
Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com
"Vinz" <Vinz@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:551899E7-E88B-45A5-8AC2-6EA31F173B73@xxxxxxxxxxxxxxxx
Hi,
I've seen a strange behavior with a C# application on Windows CE 5.0.
As
you
probably already know, in Windows CE 5.0 we only have 32 MB of memory.
I
create multiple instance of a really big object (1 MB of Data). My free
virtual memory for the process after all these allocations is 12 MB.
Then
the
destructor is called for each instance of the object. I supose that it
means
that the memory is freed. I should now have approximatly 30 MB of free
virtual memory for the process but I only have 12 MB.
What is the problem here? It seams that when managed code temporarly
needs
more memory, it never gives that memory back to the OS. Am I right? I
also
seen a lot of 64 kB commit in the memory map, does it means that when
the
managed heap is full it asks for a 64 kb block to the OS?
Where can I find more information on how the memory management is done
for
a
manged program under Windows CE 5.0?
Thanks a lot for your help,
.
- References:
- Re: Garbage collector behavior
- From: <ctacke/>
- Re: Garbage collector behavior
- From: Vinz
- Re: Garbage collector behavior
- Prev by Date: Re: Cryptography Question (trying to create a system key/code)
- Next by Date: Pda Media Player.
- Previous by thread: Re: Garbage collector behavior
- Next by thread: Re: Garbage collector behavior
- Index(es):
Relevant Pages
|