# Memory leak ?

## feli[x]

Dear Gentoo users!

I use Gentoo on my P4 with Intels i845 chipset, 768MB RAM, here is my 'uname -a':

 *Quote:*   

> Linux tanja 2.6.4-rc1 #4 Tue Mar 9 09:45:28 CET 2004 i686 Intel(R) Pentium(R) 4 CPU 2.00GHz GenuineIntel GNU/Linux

 

My desktop manager Xfce4 has a nice bar chart in the panel which says me how much memory is used. Even when I do nothing (logged out over night, in console) I get a memory usage of something like 580/768MB used.

'top' says this:

 *Quote:*   

> top - 11:35:25 up 1 day,  2:43,  4 users,  load average: 0.02, 0.02, 0.02
> 
> Tasks:  48 total,   1 running,  47 sleeping,   0 stopped,   0 zombie
> 
> Cpu(s):  2.3% us,  0.3% sy,  0.0% ni, 97.3% id,  0.0% wa,  0.0% hi,  0.0% si
> ...

 

I can't find out where it goes and I do not really how to find memory leaks. In the forum I did not find a related discussion.

If anybody has an idea ... Thanks  :Wink: 

Felix.

----------

## carbon

```

ps aux

```

That should tell you all the processes that are currently running as well as the memory usage associated with each of them.

----------

## feli[x]

I let the computer switched on the morning (wth xfree) and I get this :

 *Quote:*   

> 
> 
> top:
> 
> top - 14:04:24 up  6:06,  2 users,  load average: 0.14, 0.20, 0.18
> ...

 

 *Quote:*   

> 
> 
> ps aux:
> 
> bash-2.05b# ps aux 
> ...

 

It's strange because on one hand more than 700 MB seem to be used and on the other hand no program seems to take the memory!

An idea?

Thanks a lot!

Felix

----------

## Useful Idiot

That's just how Linux handles memory.  It doesn't get deallocated until it is necessary. If you wan't to know how much is really used use 'free -m'.

----------

## coax

I've got sort or less the same problem.

Only thing is: I'm even swapping when typing this. (and I've got 1024Mb of RAM)

here's my free -m:

```
coax@homer coax $ free -m

             total       used       free     shared    buffers     cached

Mem:           881        798         83          0          6        658

-/+ buffers/cache:        133        748

Swap:         1961          9       1951

```

----------

## eskimo

The Linux motto: "Free memory is bad memory!"

That is: For what you've got memory you don't use?

So motto sounds good, but if your processes don't need all the memory, for what we can use it?

Linux uses it for disk buffering, so everything you read or write from/to disk is buffered in memory, for performance reasons.

The next time you want to read the same file, it is read from memory.

Examples: storing a .c file and compiling it.

Configurationfiles.

So all the memory not beeing used by processes is used as disk cache.

 :Wink:  clever isn't it?

----------

## Rainmaker

 *coax wrote:*   

> I've got sort or less the same problem.
> 
> Only thing is: I'm even swapping when typing this. (and I've got 1024Mb of RAM)
> 
> here's my free -m:
> ...

 

looks like you forgat to compile "high memory support" into your kernel  :Very Happy: 

That'll give you an extra 100 megs or so. I'm not sure why it's all leaking. What I did notice, is that felix had abiword and firefox running. 

Those are apps which just use a lot of memory...

I never heard of the usage of memory as eskimo explains it, but he could be right.. There might just be a lot of filehandlers opened by some apps.

Also, felix, you had 4 users logged in. Maybe one of thos is execution some recourse-intensive tasks? Or are those just local getty logins?

----------

## eskimo

 *Rainmaker wrote:*   

>  *coax wrote:*   I've got sort or less the same problem.
> 
> Only thing is: I'm even swapping when typing this. (and I've got 1024Mb of RAM)
> 
> here's my free -m:
> ...

 

I don't think that high memory support is needed for one gig, only for more than one gig.

----------

## srs5694

 *coax wrote:*   

> I've got sort or less the same problem.
> 
> Only thing is: I'm even swapping when typing this. (and I've got 1024Mb of RAM)
> 
> here's my free -m:
> ...

 

Are you sure you're swapping? This output shows that you're only using 133MB of the RAM (the 798 figure in the "Mem" line includes buffers and cache, as eskimo suggests, and so isn't a good measure), and that only 9MB of swap is in use. It's possible that your system is sluggish for some other reason that you're mistaking for swap. Or are you concerned about that 9MB of swap space in use? If so, I wouldn't be; if memory use goes up and then comes back down, swap space can be called into use, and unless/until whatever was swapped out is needed again, it'll stay in use, so you can see something like you're reporting.

FWIW, I've also been noticing what looks like a memory leak on a lightly-loaded system, and it seems to be Firefox (four processes in ps, each consuming 10.5% of my 512MB of RAM). Firefox looks like it's got promise, so I hope this is a bug that's in the process of getting squashed. Unfortunately, it seems to be a problem with Web browsers in general today...

----------

## bfkeats

Similar problem here. I leave my computer on for a while and my memory dissapears. Here are the outputs of free -m and ps aux. HELP!

 *Quote:*   

> 
> 
> $ free -m
> 
>              total       used       free     shared    buffers     cached
> ...

 

 *Quote:*   

> 
> 
> $ ps aux
> 
> USER       PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
> ...

 [/quote]

----------

## bfkeats

Check out this thread. 

https://forums.gentoo.org/viewtopic.php?t=155348&highlight=memory+leak

I have updatedb running nightly. Once I followed their advice and opened and closed a bunch of videos, some memory was freed up.

 *Quote:*   

> 
> 
> $ free -m
> 
>              total       used       free     shared    buffers     cached
> ...

 

 *Quote:*   

> 
> 
> $ ps aux
> 
> USER       PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
> ...

 

----------

## weltraumfahrer

Hi eskimo,

> I don't think that high memory support is needed for one gig, only for more than one gig.

You need 'high memory support'!

```

My 'free -m' with one Gig shows:

             total       used       free     shared    buffers     cached

Mem:          1008        940         67          0         26        696

-/+ buffers/cache:        217        791

Swap:          517          0        517

```

Frank

----------

## Ateo

Remember, if what you think you have is 1GB of ram, then what you probably have is 1.024 MG of ram in which case you do need high memory support.

----------

## ShadowFlyP

 *Ateo wrote:*   

> Remember, if what you think you have is 1GB of ram, then what you probably have is 1.024 MG of ram in which case you do need high memory support.

 

This comment makes no sense at all.  The linux kernel does everything in nice "round" numbers (from a computer perspective).  The kernel understands 1GB to mean 1024MB or 1048576kB or 1073741824bytes: how ever you'd like to measure it.  But, if you notice in some of the 'free' outputs, the max memory is 881 meg.  This is the "magic limit" of the kernel without high-mem support.  Compile with high-mem support on and you'll gain a few hundred meg; getting much closer to your actual 1024 meg of memory.

----------

