-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: praveendotnet123
Message 4 in Discussion
Let me try to explain this..
GC runs on a separate thread which
will continounsly monitor memory allocations and de-allocations..
When the application is initialized the CLR reserves a contiguous region of
the address space which is called the managed heap
well every thing is manged in .net .. and no
surprise even memory is called MANAGED MEMORY,
GC allocates a chunk of memory and called as
Managed Heap
When the GC starts, it assumes that none of the objects on the heap are
being referenced by the application
Yes GC does maintain Pointers (counters) of
available and allocated blocks
Unlike C- language Best fit memory allocation where
the variables are allocated on random places, but GC does it diffrent as it is
managed memory it allocates memory on continious locations and this makes memory
allocation faster than compared to memory allocations in other programming
langs.
as GC maintains a ptr to next available block of
free memory in the heap.
The GC first checks whether there are any objects in the heap that are no
longer being used by the application. If such objects exist, the GC reclaims the
memory that is being used by the objects. Objects that cannot be referenced by
the application are considered �garbage�. In determining which objects are
garbage and which are not the GC uses the help provided by the JIT compiler.
When the JIT compiler compiles the IL code into native CPU instructions it
creates an internal table that contains references to objects that are allocated
on the managed heap. When the GC starts, it assumes that none of the objects on
the heap are being referenced by the application. The GC then iterates through
all the references in the JIT compiler�s table and builds a graph of all
reachable objects in the managed heap. Once this part is complete, the GC then
iterates from object to object and adds each object in the path. However, if it
attempts to add the object that is already in the graph it stops iterating
through that particular path (this prevents the infinite loops when working with
data structures like circular linked lists). At this point the GC graph contains
all elements that can be referenced by the application and obviously all any
elements not in the graph are considered to be un-reachable and thus �garbage�.
The GC then makes one final traversal through the heap and looks for contiguous
blocks of garbage objects. This is important because if small blocks are found,
the GC leaves them alone and only reclaims memory from large contiguous blocks.
The GC then shifts the non-garbage objects down in memory thus creating a large
contiguous block of memory that can be used for allocating memory very easily.
After the blocks are shifted the GC also changes the references to objects in
the application so that they point to the proper address in the heap. It is the
GC�s job to correct the pointers after shifting has been done. Once the heap is
compacted, the nextPtr is also fixed to point to the next available block of
memory, which is right after the last non-garbage object.
----- Original Message -----
From:
BDOTNET
To: BDOTNET
Sent: Friday, June 25, 2004 3:22 PM
Subject: Does Gorbage Collector frees all
inactive connection
New Message on BDOTNET
Does
Gorbage Collector frees all inactive connection
Reply
Recommend
Message 1 in
Discussion
From: AdoptiveDotnetfun
Hi to all
Does GC maintains any
Counter<o:p></o:p>
<o:p></o:p>
Does GC frees all Inactive
Connection
Regards
shyamakumar k.
[EMAIL PROTECTED]
View other groups in this
category.
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]