I need to ask about garbage collection. I have come to know that variables are stored in stacks whereas objects are stored on heap...Could anyone explain this concept or please tell me a good tutorial where I could find complete information about the storage of variables and objects.
Ya know, I've never given heap or stack a second thought. I was offended that C made people thing about such things and pleased that Java doesn't. Am I missing something? Should I care?
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joined: May 11, 2004
I think yes you are missing something in java. If you go through the link given in the first reply then you will know about. I feel that till you know how the memory is managed in your program, you can not make good programs. As long a program becomes, its memory become more crucial. Most of the programmers doesn't know what is going behind and Java prevents programs from worrying about the memory management. But if you know how JVM handles memory then you are one step ahead.
Originally posted by kapil munjal: I feel that till you know how the memory is managed in your program, you can not make good programs.
Well, I'm going to play devil's advocate here. Please describe a case where detailed knowledge of Java memory management has help you to write better software. I think we can exclude the obvious and trivial case of not retaining references to objects that ought to be garbage collected; I want to hear something more juicy.
I'm fairly deeply familiar with computer memory allocation, having done pretty tricky bits in mainframe assembler and older PC languages with segmented memory, overlays and manual memory management. One of the great values of Java is taking these issues off my plate and letting me worry about business. It has a great ratio of lines doing my business to lines keeping the computer happy.
I thought I maybe had an example of where I'd care about heap vs stack, but it didn't pan out. Color me blisfully uncaring.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com