This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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!!!
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.
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.