java memory allocation under linux

Posted by pstanton on Server Fault See other posts from Server Fault or by pstanton
Published on 2010-01-07T13:58:31Z Indexed on 2012/10/03 15:40 UTC
Read the original article Hit count: 173

Filed under:
|
|

I'm running 4 java processes with the following command:

java -Xmx256m -jar ...

and the system has 8Gb memory under fedora 12.

however it is apparently going into swap.

how can that be if 4 x 256m = 1Gb ?

EDIT: also, how can all 8Gb of memory be used with so little memory allocated to basically the only thing running?

is it java not garbage collecting because the OS tells it it doesn't need to or what?


TOP:

top - 20:13:57 up  3:55,  6 users,  load average: 1.99, 2.54, 2.67
Tasks: 251 total,   6 running, 245 sleeping,   0 stopped,   0 zombie
Cpu(s): 50.1%us,  2.9%sy,  0.0%ni, 45.1%id,  1.1%wa,  0.0%hi,  0.8%si,  0.0%st
Mem:   8252304k total,  8195552k used,    56752k free,    34356k buffers
Swap: 10354680k total,    74044k used, 10280636k free,  6624148k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1948 xxxxxxxx  20   0 1624m 240m 4020 S 96.8  3.0 164:33.75 java
 1927 xxxxxxxx  20   0  139m  31m  27m R 91.8  0.4  38:34.55 postgres
 1929 xxxxxxxx  20   0 1624m 200m 3984 S 86.2  2.5 183:24.88 java
 1969 xxxxxxxx  20   0 1624m 292m 3984 S 65.6  3.6 154:06.76 java
 1987 xxxxxxxx  20   0  137m  29m  27m R 28.5  0.4  75:49.82 postgres
 1581 root      20   0  159m  18m 4712 S 22.5  0.2  52:42.54 Xorg
 2411 xxxxxxxx  20   0  309m 9748 4544 S 20.9  0.1  45:05.08 gnome-system-mo
 1947 xxxxxxxx  20   0  137m  28m  27m S 13.3  0.4  44:46.04 postgres
 1772 xxxxxxxx  20   0  135m  25m  25m S  4.0  0.3   1:09.14 postgres
 1966 xxxxxxxx  20   0  137m  29m  27m S  3.0  0.4  64:27.09 postgres
 1773 xxxxxxxx  20   0  135m  732  624 S  1.0  0.0   0:24.86 postgres
 2464 xxxxxxxx  20   0 15028 1156  744 R  0.7  0.0   0:49.14 top
  344 root      15  -5     0    0    0 S  0.3  0.0   0:02.26 kdmflush
    1 root      20   0  4124  620  524 S  0.0  0.0   0:00.88 init
    2 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 kthreadd
    3 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 migration/0
    4 root      15  -5     0    0    0 S  0.0  0.0   0:00.04 ksoftirqd/0

© Server Fault or respective owner

Related posts about linux

Related posts about memory