• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 339
  • Last Modified:

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
0
aquasw
Asked:
aquasw
  • 3
  • 2
  • 2
  • +3
1 Solution
 
aquaswAuthor Commented:
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
0
 
ppfoongCommented:

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.

0
 
aquaswAuthor Commented:
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
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
ahoffmannCommented:
> .. 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.
0
 
aquaswAuthor Commented:
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



0
 
ahoffmannCommented:
this process uses roughly 77Mb, so what is wrong with your java (except that it consumes a lot of memory as usual)
0
 
kblack05Commented:
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.
0
 
Gabriel OrozcoSolution ArchitectCommented:
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
0
 
orogorCommented:
I think this answer might is the good one:


++++++
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.
++++++


The reason why it is not releasing memory is   is 1000x faster to access memory than the HD, so once a file has been accessed the file is keptinmemory until it is really needed, because then it is way faster to reload it from memory than from HD.
0
 
ppfoongCommented:

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.

0
 
Gabriel OrozcoSolution ArchitectCommented:
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
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

  • 3
  • 2
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now