It's a reducer program in a hadoop job. "top" command tells me that the RES is about 4.0G mem, and the DATA is 4.5G. And the system begins to use SWAP. I run the reducer with -Xmx4g option.
In the same time, I use jmap to see the histogram of the objects
jmap -histo pid
And it tells me in total all the things in the heap sum up to 1.3G mem. I repeated this several times and the result is the same. Why is such a big difference between top and jmap, where is the remaining memory?
I use sun java 7 and in my program there's lots of int[] (allocated with new).
Thanks.