l****n 发帖数: 55 | 1 遇到 java.lang.OutOfMemoryError: Java heap space
然后开始调 Xmx 从512m一直调到 40960m
我和我的小伙伴都惊呆了。。。请教这是怎么回事,谢谢 |
l****n 发帖数: 55 | |
m****r 发帖数: 6639 | 3 你要先搞清楚这个memory用到哪里去了。 40g肯定是不正常了。 是一上来就有error
, 还是跑一会再有。 用profiler看看。 基本是有leak了。
【在 l****n 的大作中提到】 : 遇到 java.lang.OutOfMemoryError: Java heap space : 然后开始调 Xmx 从512m一直调到 40960m : 我和我的小伙伴都惊呆了。。。请教这是怎么回事,谢谢
|
w**z 发帖数: 8232 | 4 take a heap dump .
【在 l****n 的大作中提到】 : 遇到 java.lang.OutOfMemoryError: Java heap space : 然后开始调 Xmx 从512m一直调到 40960m : 我和我的小伙伴都惊呆了。。。请教这是怎么回事,谢谢
|
t*******e 发帖数: 684 | 5 Does it really have 40G physical memory? Heap dump file at that size would
take forever to open. Try VisualVM to profile your app. |
l****n 发帖数: 55 | 6 Yea, I follow your suggestion and open VisualVM-heapdump, but I don't know
how to detect the problem. Could you be more specific? Thank you so much
【在 t*******e 的大作中提到】 : Does it really have 40G physical memory? Heap dump file at that size would : take forever to open. Try VisualVM to profile your app.
|
e*****t 发帖数: 1005 | 7 I am really surprised to see your application need 40GB heap, and you starte
d with 512mb heap.
You should start with a small heap size (could be even smaller than 512mb),
run it, figure out where exactly the problem happened. You can start with st
acktrace, if that doesn't help, you can use visualvm to monitor what object
type is taking up all the memory.
google some online tutorial on troubleshooting memory leak.
【在 l****n 的大作中提到】 : Yea, I follow your suggestion and open VisualVM-heapdump, but I don't know : how to detect the problem. Could you be more specific? Thank you so much
|
w**z 发帖数: 8232 | 8 try to open heap dump from eclipse MAT and start with leak report.
【在 l****n 的大作中提到】 : Yea, I follow your suggestion and open VisualVM-heapdump, but I don't know : how to detect the problem. Could you be more specific? Thank you so much
|
t*******e 发帖数: 684 | 9 Not at 40GB size though. I'd recommend to set the heap size back to 512m,
and run VisualVM Profiler to track memory leaks.
【在 w**z 的大作中提到】 : try to open heap dump from eclipse MAT and start with leak report.
|
w**z 发帖数: 8232 | 10 definitely not to take heap dump at 40G. set back to 512m, You can set jvm -
XX:+HeapDumpOnOutOfMemoryError, so it will take a heap dump when it runs
into OOM
【在 t*******e 的大作中提到】 : Not at 40GB size though. I'd recommend to set the heap size back to 512m, : and run VisualVM Profiler to track memory leaks.
|
|
|
l****n 发帖数: 55 | 11 It's because I have a 50,000 * 50,000 integer matrix ....
I change integer into byte, it doesn't help much
Then I change matrix into LinkedList to avoid continuous allocating,
it cannot pass under -Xmx4g...
-
【在 w**z 的大作中提到】 : definitely not to take heap dump at 40G. set back to 512m, You can set jvm - : XX:+HeapDumpOnOutOfMemoryError, so it will take a heap dump when it runs : into OOM
|
e*****t 发帖数: 1005 | 12 50k*50k*4byte (integer)
~10000MB
~10GB
it's obviously too big. I don't know why you have such a big matrix, but you
m
ight need to take a look of other approaches. e.g. change your algorithm or
change your data structure if you want to handle it in one jvm.
Or you should go with parallel computing routes: for example, map-reduce, or
MPI.
allocating,
【在 l****n 的大作中提到】 : It's because I have a 50,000 * 50,000 integer matrix .... : I change integer into byte, it doesn't help much : Then I change matrix into LinkedList to avoid continuous allocating, : it cannot pass under -Xmx4g... : : -
|
l****n 发帖数: 55 | 13 Yea, I just finished modifying the algorithm to avoid large matrix. Thank
you all
you
or
or
【在 e*****t 的大作中提到】 : 50k*50k*4byte (integer) : ~10000MB : ~10GB : it's obviously too big. I don't know why you have such a big matrix, but you : m : ight need to take a look of other approaches. e.g. change your algorithm or : change your data structure if you want to handle it in one jvm. : Or you should go with parallel computing routes: for example, map-reduce, or : MPI. :
|
b******y 发帖数: 9224 | 14 一般java程序如果到了需要改default memory usage参数的地步,说明程序design的不
好。 |
w**z 发帖数: 8232 | 15 这个我不同意,gc 参数是要调的。
【在 b******y 的大作中提到】 : 一般java程序如果到了需要改default memory usage参数的地步,说明程序design的不 : 好。
|
l*******m 发帖数: 1096 | 16 LinkedList even worse than array
allocating,
【在 l****n 的大作中提到】 : It's because I have a 50,000 * 50,000 integer matrix .... : I change integer into byte, it doesn't help much : Then I change matrix into LinkedList to avoid continuous allocating, : it cannot pass under -Xmx4g... : : -
|