How to monitor memory for java thread stacks
While running a Java EE application on a 32 bit jvm on Solaris x86 I get an OutOfMemoryError:Cant create native thread (or something like that).
This is because the jvm does not have enough memory for the stack of the new thread as far as I understand it.
I use both JConsole and VisualVM 1.3 to monitor the application but I do not know what the "stackmemory" is called in these tools. In VisualVM I can monitor heapspace and permgen space while JConsole shows a few more memory areas. Is any of these memory areas set aside for stackmemory? I know it is not the heapspace of course but what about permgen or Non-heap (as it is called in JConsole)
You can also try JProfiler. In JProfiler you can get hints from Thread views and Thread states in the CPU profiling views. Here is screencast for same.
You can also check following to debug your issue: (referenced from link) There are a few things to do if you encounter this exception.
Some part of your code may be creating lot of Threads.
Try using ThreadPoolExecutor (thread pooling) in your code to limit threads in your application, And tune your threadpool size accordingly for better performance.
链接地址: http://www.djcxy.com/p/82784.html上一篇: Linux上的JAVA堆大小监视
下一篇: 如何监视Java线程堆栈的内存