My Java app terminates unexpectedly with the java.lang.OutOfMemoryError. I'm going through my application trying to find possible causes of the problem, and I have a number of questions.
Question One
If I have a loop executes a great many times and the loop includes instructions like
Will this contribute to the out of memory error?
Question Two
My app has a number of data structures, and when I'm done with them I set them to null then call System.gc(). Is this the correct way to force garbage collection?
Question Three
One solution I'm trying is to increase the jvm heap size, but first I need to know what the default heap size is so I can start from there. How do I determine the default heap size?
Thanks!
Question One
If I have a loop executes a great many times and the loop includes instructions like
Code:
String myString = "something";
Will this contribute to the out of memory error?
Question Two
My app has a number of data structures, and when I'm done with them I set them to null then call System.gc(). Is this the correct way to force garbage collection?
Question Three
One solution I'm trying is to increase the jvm heap size, but first I need to know what the default heap size is so I can start from there. How do I determine the default heap size?
Thanks!