raghav singh wrote:It is a dead end
Actually, it's a dead-end for
you, not for your program. And the reason is that
Java (or the JVM) doesn't WAN'T you to be managing its memory.
If you really need to manage memory, then you want a language like C or C++ - and believe me, you'll spend a LOT of time on it, because proper memory management is NOT simple. The designers of Java, rightly or wrongly, decided that most people probably
don't need it, so they've made it impossible for you to decide how and when it will happen.
Note that that's
not the same as saying that it WON'T happen; simply that you can't
predict it. A Java program will
not fail due to lack of memory if there
is space that can be reclaimed by the garbage-collector.
HIH
Winston