aspose file tools*
The moose likes Performance and the fly likes why my program throw the OutOfMemeory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "why my program throw the OutOfMemeory" Watch "why my program throw the OutOfMemeory" New topic
Author

why my program throw the OutOfMemeory

Dingcheng lee
Greenhorn

Joined: Aug 26, 2002
Posts: 18
In my program(is a monitor program).
after it run 6 hours ,it throw the Error of OutOfMemory.but when i see the system memory ,there are a larger memory not used. and how can I solve this problem and use the memory that not used.let it run a longer time?thanks!!!
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Even though you have free RAM, the JVM may not have access to it. You can increase the JVM heap size by giving certain parameters.
For example,
java -ms64M -mx128M example.MyClass
starts the JVM with an initial heap size of 64 megabytes and gives it permission to grow up to 128 megabytes. The JVM will not exceed the mx-value.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Oh, almost forgot.
The fact that your program slowly runs out of memory implies a "memory leak" in your code. I'd suggest double-checking all code that deals with collections of some sort and ensure that references are nullified as intended.
Dingcheng lee
Greenhorn

Joined: Aug 26, 2002
Posts: 18
dear Lasse Koskela ,thanks a lot!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why my program throw the OutOfMemeory