| RE: [aus-dotnet] A Comparison of .NET and Java GC |
- From: Nick Lothian
- Subject: RE: [aus-dotnet] A Comparison of .NET and Java GC
- Date: Wed, 07 Jul 2004 11:16:23 +1000
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
> > ".NET GC is Excellent - Better Than Java" - > http://weblogs.asp.net/pwilson/archive/2004/02/20/77448.aspx > > Ok, first 4 probably not exactly what you're after, but the > last one is an > interesting read. First 4 may give those asking about the GC > a bit more info > on it. I don't know much about the .NET GC, but I do know the Java GC enough to know that this guy is confusing garbage collection and resource management. I guess that's a common enough confusion, but it isn't good to see it put around as a fact. He says: "As for the Dispose method, I learned that this pattern is commonly used and accepted as necessary in Java, but it was never officially made part of Java itself, which is one place .NET is actually better since they learned from Java's experience." To a certain extend this is true - is you have a resource in Java that you need to clean up after user you need to use try {...} finally {} blocks. IDisposable is a nice piece of syntactic sugar that makes that a bit cleaner. A nice summary of this is at http://www.neward.net/ted/weblog/index.jsp?date=20040123 However, that has NOTHING to do with garbage collection - in fact it is the opposite. IDisposable or try {..} finally {} let you clean up resources that garbage collection do not manage (typical examples are things like managing pooled connections to something where you want to keep the connection objects, but close the network connection). Back to Garbage Collection: A good overview of the .NET GC is <http://msdn.microsoft.com/msdnmag/issues/1100/GCI/default.aspx> and <http://msdn.microsoft.com/msdnmag/issues/1200/GCI2/default.aspx> There is probably more documentation available on Java GC, simply because it has been around longer and gone through more revisions. Start with http://java.sun.com/docs/hotspot/gc/index.html and http://java.sun.com/docs/hotspot/gc1.4.2/faq.html I wrote a blog entry on tuning the Java GC with the Java Jvmstat tool, which includes some more links: <http://www.mackmo.com/nick/blog/java/?permalink=jvmstat.txt>. Note that the Java 1.5 VM (or Java 5 VM as it is now know) does more goal orientated self tuning of its GC algorithm (they call it garbage collector ergonomics). I haven't looked at this in a great deal of detail, but I'd consider it a good thing since GC tuning is currently something of a black art. See http://java.sun.com/j2se/1.5.0/docs/guide/vm/gc-ergonomics.html If you are really interested in garbage collection I highly recommend running jvmstat against a Java program. It is quite amazing to see the generational GC working - you watch as objects get copied from the Eden space to the survivor pools, and then on to the old and permanent generations. You can see the difference the various GC algorithms make, too. Nick Nick _________________ You are a part of the Australian "dotnet" mailing list. To unsubscribe send "unsubscribe dotnet" or to re-subscribe send "subscribe dotnet Your Name" in the body of the email to: imailsrv@xxxxxxxxxxx List managed by: http://www.stanski.com
(Click here for more information on the aus-dotnet mailling list)
- Follow-Ups:
- Re: [aus-dotnet] A Comparison of .NET and Java GC, Joseph Cooney
- Prev by Date: [aus-dotnet] Roadmap for Garbage Collection in the Microsoft .NET Framework
- Next by Date: RE: [aus-dotnet] A Comparison of .NET and Java GC
- Previous by thread: RE: [aus-dotnet] A Comparison of .NET and Java GC
- Next by thread: Re: [aus-dotnet] A Comparison of .NET and Java GC
- Index(es):
