Ulf Dittmer wrote:Does the JVM actually run out of memory? Just because the memory isn't released immediately doesn't mean it won't eventually if it is needed.
No, I don't wait till the JVM runs out of memory, but I think it will be out of memory soon because I see the memory increases significantly from 100MB to 500MB within a minute. So I have to stop the JVM process first. And there seems to be no clue that the memory is reclaimed.
How can you say that if you didn't even get an OutOfMemoryError? The JVM will not throw that error unless it really has to. It will always first try to garbage collect objects to prevent it. Perhaps it would have done so but you just didn't give it a chance.
Oh my god!!!
I don't know why, that memory leak problem only happens when I run the program inside NetBeans. Somehow the IDE does not release memory immediately.
But when I run the program outside NetBeans, there seems to be no problem at all.
What a strange behavior!
Ulf Dittmer wrote:I'll ask again: has the program ever caused an actual memory problem (and not just an imagined one like you're describing)?
It doesn't cause OutOfMemory error, but I can see the memory allocated for the program rises significantly just in seconds.
Joined: Mar 22, 2005
That's expected behavior is something memory-intensive is done. Keep running the program for longer to see if it actually runs out memory. Normally, the garbage collector (GC) should reclaim the memory before that (but not right after the instructions causing the memory to be allocated, as you seem to think).