Chinaunix首页 | 论坛 | 博客
  • 博客访问: 98327
  • 博文数量: 19
  • 博客积分: 807
  • 博客等级: 上士
  • 技术积分: 260
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-17 10:28
文章分类

全部博文(19)

文章存档

2011年(19)

我的朋友

分类: 系统运维

2011-01-10 18:02:17

运行程序,提示 java.lang.OutOfMemoryError
(1)在myeclipse里面进行调试时,调高内存通过下面方法
 
window-> preferences-> myeclipse-> application server-> Weblogic X -> jdk-> optional java jvm arguments里加  
 -Xms128m -Xmx512m
 
(2)另外再转一个关于weblogic内存溢出的问答
 
  1. 最好不要自己写线程去GC,GC是JVM的工作,我们最好不要干涉它。
  2. 下面粘贴一段关于WebLogic out of memory问题的经典问答,连如何用profiling工具去解决这个问题,以及使用profiling工具的注意事项都提到了。
  3. FAQ: OutOfMemory in WebLogic
  4. From time to time I see questions like this:
  5. Q: "We are seeing OutOfMemory error in the WebLogic log, after that our app becomes inaccessible. The application is not under heavy load. In fact, we can see it even if the server is idle. WebLogic performance console shows that there is plenty of heap available. What's wrong?".
  6. A: Given the symptoms above, the most likely cause of the problem is that the default size of the heap allocated by JVM for long living objects is often too small for a J2EE application is general and for one under WebLogic in particular. Weblogic uses caching a lot, so if you've got many EJBs, there will be plenty of long living object, and they may not fit into perm heap.
  7. To fix this problem, you need to increase MaxPermSize JVM parameter. Go to WebLogic startup script and add -XMaxPermSize=64m or -XMaxPermSize=128m to JVM startup parameters. If you don't have an application memory leak, this change should take care about the problem.
  8. Q: But how do I know if it's not an app memory leak?
  9. A: The first symptom of the app memory leak is that in addition to OutOfMemory, you will see that the memory graph in WebLogic performance console hits the top, and forcing GC doesn't change anything. Fixing this problem is relatively easy. Get a good profiler tool, like OptimizeIt of JProfiler, and run a load test while memory profiling is enabled. Set up a filter to see only your classes and fined ones taking most of memory. It's likely that the same objects will have largest instance counts.
  10. Tips for setting up a profiler.
  11. First, set the JVM memory to as minimum as possible. If you expect WebLogic to run with 1Gb of JVM heap, set it to much lower values at which app can run. It can be 32M, 64M, depending on the app. Is sounds odd, but the reason is that the memory profiler catches JVM GC activities, and as there will be much more object in 1GB than in 64Mb, that GC under profiler will be dead slow, it can be hours, virtually. Set memory to as low as possible.
  12. Second, turn off anything except the memory profiling. Memory profiling itself is slow, so you will want yo avoid any additional overhead in this case. Performance profiling is to be turned off in any case.
 
参考:
 
 
 
阅读(2151) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~