What are default values for the native stack (-Xss) and Java stack (-Xoss)? The Native stack size is machine-dependent, because it is based on the platform's C stack usage. The Java stack size is 400*1024 What is the difference between the GC policies optavgpause and optthruput?
optthruput disables concurrent mark. If you do not have pause time problems (indicated by erratic application response times), you should get the best throughput with this option.
optavgpause enables concurrent mark. If you have problems with erratic application response times in garbage collection, you can alleviate them at the cost of some throughput when running with this option.
What is the default GC mode (optavgpause or optthruput)? optthruput - that is, concurrent marking is off. How many GC helper threads are spawned? What is their work? A platform. with n processors will have n-1 helper threads. These threads work along with the main GC thread during:- Parallel mark phase
- Parallel bitwise sweep phase
You gain little by setting -Xgcthreads to more than n-1 other than possibly alleviating mark-stack overflows, if you suffer from them.
Is incremental compaction enabled by default? Yes. But incremental compaction works only if the size of the heap is at least 128 MB. What is double allocation failure? Double allocation failure refers to the condition in which the GC believes that it has freed enough heap storage to satisfy the current allocation request, but still the allocation request fails. This is clearly an error condition, and it results in the JVM closing down with a "panic" error message. What are pinned and dosed objects? Pinned and dosed objects are the immovable objects on the Java heap. GC does not move these objects during compaction. These are the major cause of heap fragmentation.All objects that are referenced from JNI are pinned. All objects on the heap that are referenced from the thread stacks are dosed.
How can I prevent Java heap fragmentation? Note that the following suggestions might not help avoid fragmentation in all cases.- Start with a small heap. Set -Xms far lower than -Xmx. It might be appropriate to allow -Xms to default, because the default is a low value.
- Increase the maximum heap size, -Xmx.
- If the application uses JNI, make sure JNI references are properly cleared. All objects being referenced by JNI are pinned and not moved during compaction, contributing significantly to heap fragmentation.
- Increase the number of GC helper threads using -Xgcthreads command-line option
- Decrease the size of the Java heap using the -Xmx setting.
- Use a small initial value for the heap or use the default.
- Shortage of memory for other operations of the JVM.
- Some other memory allocation failing. The JVM throws an OutOfMemoryError in such situations.
- Excessive memory allocation in other parts of the application, unrelated to the JVM, if the JVM is just a part of the process, rather than the entire process (JVM through JNI, for instance).
- The length of a chunk of memory is zero or too big to fit onto the heap.
- If the alloc bit is set (reachable object) and its method table or class block is NULL or invalid.
- If verifyHeap shows a problem before GC, that usually means that the problem was created by allocation routines or something outside the GC. If verifyHeap after GC shows a problem, while the verifyHeap before that GC has not shown any problems, it is likely that the problem has been created by GC.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/27378/viewspace-582493/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/27378/viewspace-582493/