s*****p 发帖数: 5342 | 1 最近,我的JAVA APPLICATION(running on JBoss)总是out of memory. 我
知道可以加MEMORY to JVM.已经512MB了.我想还是我的PROGRAM有问题.
我不觉得IT需要那么多.问题可能还是出在MEMORY RELEASE,因为我的
CODE有一堆LOOP.怎么才能保证快速RELEASE MEMORY呢?
3x! | c*z 发帖数: 62 | 2 give it 1G or 2 and let it run for a while. If it still crashes,
maybe you have memory leak. If it doesn't, it is very likely that
you application does need more memory.
【在 s*****p 的大作中提到】 : 最近,我的JAVA APPLICATION(running on JBoss)总是out of memory. 我 : 知道可以加MEMORY to JVM.已经512MB了.我想还是我的PROGRAM有问题. : 我不觉得IT需要那么多.问题可能还是出在MEMORY RELEASE,因为我的 : CODE有一堆LOOP.怎么才能保证快速RELEASE MEMORY呢? : 3x!
| B*********h 发帖数: 800 | 3 run the application and get the jps id for the JVM.
start a JConsole(part of JDK, google) and watch how the memory grows. If it
keeps growing boundlessly, you have a problem. A more powerful profiler allo
ws you to monitor all object intances by type and trace back to the code whe
re they are generated.
【在 s*****p 的大作中提到】 : 最近,我的JAVA APPLICATION(running on JBoss)总是out of memory. 我 : 知道可以加MEMORY to JVM.已经512MB了.我想还是我的PROGRAM有问题. : 我不觉得IT需要那么多.问题可能还是出在MEMORY RELEASE,因为我的 : CODE有一堆LOOP.怎么才能保证快速RELEASE MEMORY呢? : 3x!
| g*****g 发帖数: 34805 | 4 Give it 1GB to have a try, if it still runs out, you probably
have memory leak, find a profiler then.
【在 s*****p 的大作中提到】 : 最近,我的JAVA APPLICATION(running on JBoss)总是out of memory. 我 : 知道可以加MEMORY to JVM.已经512MB了.我想还是我的PROGRAM有问题. : 我不觉得IT需要那么多.问题可能还是出在MEMORY RELEASE,因为我的 : CODE有一堆LOOP.怎么才能保证快速RELEASE MEMORY呢? : 3x!
| l*******r 发帖数: 2 | 5 如果增加JVM memory不能解决,应该考虑是否Perm Gen空间不够。
对于在container里面运行的程序,这个问题很有可能发生。
试一下 -XX:MaxPermSize=256m,或更大。
用类似VisualGC这样的工具分析一下内存,可能会更容易找到问题。
【在 s*****p 的大作中提到】 : 最近,我的JAVA APPLICATION(running on JBoss)总是out of memory. 我 : 知道可以加MEMORY to JVM.已经512MB了.我想还是我的PROGRAM有问题. : 我不觉得IT需要那么多.问题可能还是出在MEMORY RELEASE,因为我的 : CODE有一堆LOOP.怎么才能保证快速RELEASE MEMORY呢? : 3x!
| l*******r 发帖数: 2 | 6 看看你有没有用static变量来直接或间接(static member -> an object -> ... -> a
Map)存放大的Map,List,Array。如果不是必须,不要这么做,应为他们可能永远都不
会被释放。
【在 l*******r 的大作中提到】 : 如果增加JVM memory不能解决,应该考虑是否Perm Gen空间不够。 : 对于在container里面运行的程序,这个问题很有可能发生。 : 试一下 -XX:MaxPermSize=256m,或更大。 : 用类似VisualGC这样的工具分析一下内存,可能会更容易找到问题。
|
|