Some interesting points:
1:
… When a JVM’s Java heap is swapped out, the garbage collector’s performance becomes extremely poor, to the extent that the application can appear to hang. If multiple Java runtimes are in use on a single machine at the same time, the physical memory must be sufficient to fit all of the Java heaps. …
2:
… Each Java thread requires stack space. Stack size varies among implementations, but with default settings, each thread could occupy up to 756KB of native memory. …
3:
”Windows Java address space” (Phil Vickers and Amar Devegowda, IBM Java Technology Centre, December 2005): Find out how to maximize the IBM Java memory address space on 32-bit Windows systems.
… Recall that the Java heap must be a contiguous space and that its practical max size is around 1.5 GB. …
Update: 5.12.2009
Mysteries of ”cannot create new native thread”. Why such things occurs?
Virtual Memory Usage from Java under Linux, too much memory used
Java and default stack size for threads: 0.4MB, 1MB, or 8MB?
Understanding ulimit output
Are +”Xss” +”ThreadStackSize” the same?
Troubleshooting Memory Leaks
Quickly poking around, it appears that it would be usefull to peek into pmap
output for process. In my linux box it appears that ”pmap -x PID | grep 308 | wc -l” corresponds very closely into amount of threads in application (308 being memory allocated to some mysterious ”anon”, actually there is 12 + 308 per thread in pmap).
So it looks like in this system, each thread is consuming 320 KB of native memory. However, interestingly, after some tens of threads had been terminated in java, these 12+308 blocks of memory still haven’t been released. Is that some memory leak bug in Sun 1.6.0 JVM?
Update: 13.3.2010
Memory Leak Detection & Memory Diagnosis
Das Java Memory Modell (1. Akt)
Update: 12.6.2010
Java Memeory Overview Public
Eclipse MemoryAnalyzer
Finding PermGen Memory Leaks with YourKit
Inside The Jvm Memory Management And Troubleshooting
OutOfMemoryError (on HeapSpace, PermGen) and JVM Performance Tuning