Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / January 2006

Tip: Looking for answers? Try searching our database.

Heap and Garbage Collection

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
pradeep_TP - 10 Jan 2006 14:04 GMT
Hi all,

I was reading this article
(http://msdn.microsoft.com/msdnmag/issues/1200/GCI2/default.aspx) in MSDN,
written by Jerffrey Richter. He has explained the working of gabage
collection pretty very well.

What is confusing me here is when he talks about heap. He says that garbage
collection must occur when heap fills. Is it different from saying Heap is
full?  I remember someon saying that garbage collection will occur when the
heap is full. I only want to know whether the garbage collection occur only
when the heap is full.

Thanks
pradeep_tp
Willy Denoyette [MVP] - 10 Jan 2006 14:21 GMT
| Hi all,
|
[quoted text clipped - 11 lines]
| Thanks
| pradeep_tp

No, GC occurs when the GC heap fills, that is before he is 'full'. The GC is
triggered when a certain Gen0 threshold is reached, the threshold depends on
a number of heuristics, like the size of the CPU L2 cache, the version of
the CLR and can change dynamically depending on the allocation pattern.

Willy.
Naveen - 10 Jan 2006 14:37 GMT
The GC in CLR 2.0 can also occur on a timely basis irrespective of the
threshold.
Willy Denoyette [MVP] - 10 Jan 2006 17:17 GMT
| The GC in CLR 2.0 can also occur on a timely basis irrespective of the
| threshold.

Not that I can see, start a managed application that doesn't allocate
objects while it keeps running, you will never see the GC kick in.

Willy.
Naveen - 10 Jan 2006 17:26 GMT
Here is a link to Rico Mariani PDC Session which mentions about the
"Time-base criteria helps find idle cases"
http://microsoft.sitestream.com/PDC05/FUN/FUNL04_files/Botto_files/FUNL04_Mariani.ppt.

So the GC has been changed to occur on a timely basis.
Willy Denoyette [MVP] - 10 Jan 2006 17:49 GMT
| Here is a link to Rico Mariani PDC Session which mentions about the
| "Time-base criteria helps find idle cases"

http://microsoft.sitestream.com/PDC05/FUN/FUNL04_files/Botto_files/FUNL04_Mariani.ppt.

| So the GC has been changed to occur on a timely basis.

No this doesn't mean it's running on a timely basis, it means that the GC
not necessarely kicks off at the point the threshold is reached, it may be
delayed until idle time after the threshold has been reached. This is done
for performance reasons (a GC run stops all managed threads), now the GC
might get suspended until the CLR memory allocator is idling. The net result
however is that the size of the GC can get really large when you are
constantly allocating/deallocating small objects.

Willy.
Naveen - 10 Jan 2006 17:54 GMT
I guess your right :)
pradeep_TP - 11 Jan 2006 05:50 GMT
Hi willy,

You have mentioned "..The net result
> however is that the size of the GC can get really large ..". I didnt quite get the meaning of saying "size of GC". Did you mention about the heap. Also I would like to know, while a .net application is running, will the heap ever be full at any point of time due to garbage collection running in the background. can you point me to any good URl giving more detail about how and whys of heap management in .net context.

Thanks for your answers :)
pradeep_tp

> | Here is a link to Rico Mariani PDC Session which mentions about the
> | "Time-base criteria helps find idle cases"
[quoted text clipped - 12 lines]
>
> Willy.
Willy Denoyette [MVP] - 11 Jan 2006 21:39 GMT
Sorry, ...size of the GC heap can get ....

What I mean is that the Gen0 threshold is something like 256Kb - 500Kb, But
due to this enhancement, it's possible that Gen0 grows above this threshold
and that it reaches values like 2MB before the GC kicks in.
Note that the GC never runs in the background, it runs on a user thread
while all other managed threads in the application are suspended.
Check Maoni's Blogs at http://blogs.msdn.com/maoni/default.aspx for more
info about this subjects.

Willy.

| Hi willy,
|
| You have mentioned "..The net result
| > however is that the size of the GC can get really large ..". I didnt quite get the meaning of saying "size of GC". Did you mention about the
heap. Also I would like to know, while a .net application is running, will
the heap ever be full at any point of time due to garbage collection running
in the background. can you point me to any good URl giving more detail about
how and whys of heap management in .net context.

| Thanks for your answers :)
| pradeep_tp
|
| > | Here is a link to Rico Mariani PDC Session which mentions about the
| > | "Time-base criteria helps find idle cases"

http://microsoft.sitestream.com/PDC05/FUN/FUNL04_files/Botto_files/FUNL04_Mariani.ppt.

| > | So the GC has been changed to occur on a timely basis.
| >
[quoted text clipped - 7 lines]
| >
| > Willy.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.