搜集的一篇OutOfMemoryError
最近遇到如下问题,主要是在做线程池+数据库连接池时遇到的,虽然有如下解决方案,但效率还是没有多大提升了。
ThreadPoolExecutor threadPool = new ThreadPoolExecutor(10, 3000, 1,
TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(3000),
new ThreadPoolExecutor.CallerRunsPolicy());
具体链接如下:
http://topic.csdn.net/u/20071012/10/bfc0c3c0-cc4a-4cfd-a1e3-76158efc8455.html
Exception in thread "CompilerThread0" java.lang.OutOfMemoryError: requested
32756 bytes for ChunkPool::allocate. Out of swap space?
Possible causes:
- not enough swap space left, or
- kernel parameter MAXDSIZ is very small.
解决如下:
-Xms512m -Xmx768m -XX:MaxPermSize=128m -XX:NewSize=300m -XX:MaxNewSize=300m -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -Xss128k