The short answer is that all dynamically allocated memory (heap) is shared by all threads unless you use the ThreadLocal Java class to declare variables that are local to the thread only.
In fact, the traditional Java memory model of shared data between threads (when using ThreadLocal) is what makes threads so powerful for sharing memory across threads.
As mentioned in sk4l, there is a getThreadAllocatedBytes method of the ThreadMXBean method if your JVM supports it, but keep in mind that this is usually just an approximation.
Finally, the most recent versions of Oracle JDK and OpenJDK include jconsole and JDK 6u7 and later versions include VisualVM , which you can use to join your process and view memory and thread information.
source share