Link to home
Start Free TrialLog in
Avatar of aquasw
aquasw

asked on

memory problem

Hi Experts

I have memory leak problem, with one of my programs.
I ran it on linux machine, that has 2gb memory.
I start the machine before 15 hours.
when I started to run my machine, I write "top" and the information that I have got is that I have 394mb of used memory, and 1.66gb of free memory.
when I came back, after 15 hours that the linux ran some programs, I check the memory (with the top command)
and I have found that I have 1.87gb used memory and 192mb of free memory.
I am sure in 99% that the memory leak is from specific program.
when i ran the "top" command the proccess that ran this program(the suspicious program) was java and it used 88mb,and after 15 hours it uses 182mb.
but where is the other 1.4gb of free memory (it was free before 15 hours)?
the linux write to me that is it used memory , but which proccess/program useing them ?

Thanks
Avatar of aquasw
aquasw

ASKER

Hi experts ...

I want to say one more detail

even if I kill (kill -9 [pid]) the proccess, it doesn't free the other (1.44gb) used memory.

Thanks

Linux is designed to use as much physical memory as possible.

It will make use of unused physical memory to become buffer and cache, which can be reclaimed immediately when in need.

When a process terminated, it could stay as cached program in the physical memory. The next time you run it, the startup will be very fast. When there is insufficient free memory, the cache will be reclaimed.

Avatar of aquasw

ASKER

Thanks ppfoong

but, the problem with it, that if I ran the program enough time , more than 15 hours and the program use all the phisical memory, it starting using that swap memory,and that not good.
if it's only buffered memory , why it still using it ? and don't release it, because there is important things to do with the memory for proccess that run now ?

thanks
> .. more than 15 hours and the program use all the phisical memory, ..
which program?

as ppfoong said: linux is designed to use all available memory (whatelse would you do with unused memory:), so the top command (as also w) will tell you that all memory is in use, somehow. top will also tell you which programs consume physical and virtual memory. To get more details about swapping, use vmstat.
Avatar of aquasw

ASKER

Hi experts ...

about the cached memory ...
the chached memory is growing (when I type the "top" command I can see it)  but it don't free it ....
now the cached memory is more than 1gb

but another interesting thing is that I checked the proccess (program) that has this "memory leak"

I typed

cat /proc/[pid]/status
and this is what I have got  :

Name:   java
State:  S (sleeping)
Tgid:   26911
Pid:    26911
PPid:   26910
TracerPid:      0
Uid:    0       0       0       0
Gid:    0       0       0       0
FDSize: 256
Groups: 0 1 2 3 4 6 10
VmSize:   770384 kB
VmLck:         0 kB
VmRSS:    201060 kB
VmData:   685492 kB
VmStk:      2036 kB
VmExe:        60 kB
VmLib:      8652 kB
SigPnd: 0000000000000000
SigBlk: 0000000000000004
SigIgn: 8000000000000000
SigCgt: 1000000080005ccf
CapInh: 0000000000000000
CapPrm: 00000000fffffeff
CapEff: 00000000fffffeff


as you can see it's a java program ... do you know what cause to it ?

thanks



this process uses roughly 77Mb, so what is wrong with your java (except that it consumes a lot of memory as usual)
Avatar of Kelly Black
Linux never desperation swaps. I would not be concerned with this kind of behavior unless it starts swapping to disk a lot. A memory leak of the real sort would be very evident as programs would start writing to memory, and just never come back, so they would zombify, or just die.

If the system isn't swapping off the hard disk, I would not be so concerned.
with 2 gigs of ram, to have swap used is not good.

still you need to tell us what is the program it's taking this much memory, but you need to take a picture of the system when it is using swap.

start "top" and type a M so see all sorted by Memory use, then try to identify top programs
ASKER CERTIFIED SOLUTION
Avatar of orogor
orogor

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

As a conclusion, you do not need to worry much about the memory allocation and management, which is taken care by the kernel, unless your server start to use swap, and you can see the harddisk keeps on blinking continuously.

It is normal for you to see the physical memory being filled up after some times since last reboot. In fact, everyone of us see the same thing in our servers too.

reviewing your last post, that Java program is takin 770MB !!!!

It's good you identified what program is having the memory leak.
now please report the bug into the bugtrack list for that program.

Google is your friend in this cases