Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have started learning about C# and I come to what is called 'Automatic memory management' or 'Garbage collectors' and I'm wondering if Java contains something like this as well? and if it does, does it do that as effective as C# when it comes to windows desktop application and web applications?

share|improve this question
add comment

3 Answers

Java is a garbage collected language though the collection model is different than C#'s. Effectiveness would vary considerably depending on the structure of the program but Java does run just fine on Windows and the Web.

share|improve this answer
2  
Also, the actual GC strategy (and the way memory is organized) used by the JVM can be adjusted with startup parameters. See oracle.com/technetwork/java/javase/gc-tuning-6-140523.html –  Hanno Fietz Nov 15 '11 at 10:30
add comment

Yes, the algorithm used by the Microsoft's 'Common Language Runtime' is known as the Mark-Compact Algorithm. I also read that the Java Runtime uses this as well. Also, if you run into any other C# vs Java sort of comparison like questions, this document may be of interest. A Comparison of Microsoft's C# Programming Language To Sun Microsystems' Java Programming Language, By Dare Obasanjo.

share|improve this answer
add comment

Yes, Java does have garbage collection and "effective" is a relative term hard to judge without some more specific criteria.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.