jvm linux and memory not released

R

rony

Hi,

When I'm stoping java process abnormally ( by kill process ) I noticed
that some of the memory is left behind, the java process don't release
all the memory it has used (The java process is little heavy ,using a
lot of sockets).
This happens only with the newer linux version it doesn't happen in
redhat 7.3

currently i'm using linux read hat entprise release 3 with kernel
2.4.21-20.ELsmp.

does anyone know sonething about it?

Thanks.
 
S

Stefan Schulz

Hi,

When I'm stoping java process abnormally ( by kill process ) I noticed
that some of the memory is left behind, the java process don't release
all the memory it has used (The java process is little heavy ,using a
lot of sockets).

What do you mean "leave behind" memory? What exactly happens? If there is
memory that was in use by the java process that is not reclaimed as soon
as possible by the kernel, then this is a kernel bug (not impossible, but
not very likely). On the other hand, some memory might be shared across
several processes (a shared library, for example, might be made available
to several applications at once). And finally, there is always the
buffering and caching of data. Memory is not allowed to "sit idle" when
it's contents might be used later on (for example to avoid having to load
the exact same data from disk once more)
 
G

Gordon Beaton

When I'm stoping java process abnormally ( by kill process ) I
noticed that some of the memory is left behind, the java process
don't release all the memory it has used (The java process is little
heavy ,using a lot of sockets).

This happens only with the newer linux version it doesn't happen in
redhat 7.3

"ps" won't show any entries for processes that have terminated, so how
do you see this memory, and what makes you think it belongs to java?
How are you observing this phenomenon and what problems is it causing?

Realize too that the kernel caches a lot of things, so "free" or "top"
may show little free physical memory even though it is available to
processes that need it.

/gordon
 
R

ronybaryo

Stefan said:
What do you mean "leave behind" memory? What exactly happens? If there is
memory that was in use by the java process that is not reclaimed as soon
as possible by the kernel, then this is a kernel bug (not impossible, but
not very likely). On the other hand, some memory might be shared across
several processes (a shared library, for example, might be made available
to several applications at once). And finally, there is always the
buffering and caching of data. Memory is not allowed to "sit idle" when
it's contents might be used later on (for example to avoid having to load
the exact same data from disk once more)

--
In pioneer days they used oxen for heavy pulling, and when one ox
couldn't budge a log, they didn't try to grow a larger ox. We shouldn't
be trying for bigger computers, but for more systems of computers.
--- Rear Admiral Grace Murray Hopper

I use top to see how much free memory I have and on each run of the
application I see less memory. I also can see that when there is no
free memory (in top) then more swap is used (also using top) and my
application is not running well. this make me think that not all memory
is released, the java process leave memory that cannot be used anymore
by the os.
This is not happening in readhat 7.3.

Rony
 
J

Juha Laiho

(e-mail address removed) said:
I use top to see how much free memory I have and on each run of the
application I see less memory. I also can see that when there is no
free memory (in top) then more swap is used (also using top) and my
application is not running well.

Please use 'free' instead of 'top'; the memory figures given by 'free'
are a bit more readable than those displayed with 'top'. So, on a machine
that is otherwise idle, run 'free' before starting the program, and
after the program is terminated, and look at the differences.

~$ free
total used free shared buffers cached
Mem: 385592 380804 4788 0 65712 236256
-/+ buffers/cache: 78836 306756
Swap: 265064 132500 132564

.... here, the figure that should be of greatest interest is the 'free'
column of the second line. Linux is rather aggressive in trying to
make the best use of your RAM, so it will try to push as much of
incative application pages into swap as it can, opting to use the
RAM for active application pages and file system cache - as you see
from the above: there is ~300MBytes of free memory, and still ~130MBytes
of program pages are pushed into swap - to give almost all of that
~300Mbytes to buffers and cache.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top