hi, will java garbage collection ensure that my program will never run short of memory, no matter what ever i code?
posted 12 years ago
No, garbage collection ensures that the memory will be clean of objects you don't reference any more. If you create enough objects in memory and keep a reference to all of them, you will surely get java.lang.OutOfMemoryError and your program will terminate. But if you create the same amount of objects and loose references to them, you won't get that error, since they will be garbage collected.
The sword of destiny has two blades, one of them is you.