Memory Leak
Paul Howarth
paul at city-fan.org
Thu Feb 10 18:05:33 UTC 2005
Hongwei Li wrote:
>>On Thu, Feb 10, 2005 at 10:15:39AM +0100, DafyddHugh wrote:
>> > Hi,
>> >
>> > I am running Fedora Core 3 on a machine with 512Mb memory.
>> >
>> > There are 2 problems
>> >
>> > 1. When the physical memory is exhausted the system tries to use swap,
>>the disk spins and the system becomes unusable. This is under
>>investigation, but any ideas would be appreciated.
>> >
>> > 2. More of an issue. Every few minutes (4 or 5) the available physical
>>memory decreases by 64k, while the cache memory increases by 4k or 8k.
>>This is happening on a very "lean" machine (see simple ps post below).
>>No processes seem to be increasing memory at the same time. Usually the
>>machine also runs httpd, mysqld, popfile in addition to the posted ps.
>>It looks like a memory leak, but I can't find the offending process -
>>any ideas?
>>
>>Which kernel version are you running ?
>>What does the output of free, and slabtop look like ?
>>
>> Dave
>
>
> I have a similar question as 2 above. My system: 2.6.10-1.741_FC3
> The free command displays the free physical memory decreasing continuesly
> every minute or so:
>
> # free
> total used free shared buffers cached
> Mem: 1035788 1017952 17836 0 296172 81224
> -/+ buffers/cache: 640556 395232
> Swap: 1052216 8120 1044096
>
> # free
> total used free shared buffers cached
> Mem: 1035788 1017980 17808 0 296228 81244
> -/+ buffers/cache: 640508 395280
> Swap: 1052216 8120 1044096
>
> # free
> total used free shared buffers cached
> Mem: 1035788 1018100 17688 0 296260 81300
> -/+ buffers/cache: 640540 395248
> Swap: 1052216 8120 1044096
>
> Is it normal? I don't know what will happen if the free memory goes to
> zero, but it seems that, in my system, it never goes to zero. At some
> point, it jumps up a little. Please note, my this system is a testing
> system, only 2 regular users were set up, and only 1 user is checking the
> testing emails (plus root's shell). It was just rebooted 2 days ago:
>
> # top
> top - 11:51:21 up 1 day, 21:36, 3 users, load average: 0.00, 0.00, 0.00
> Tasks: 90 total, 1 running, 86 sleeping, 0 stopped, 3 zombie
> Cpu(s): 0.3% us, 0.0% sy, 0.0% ni, 99.3% id, 0.0% wa, 0.3% hi, 0.0% si
> Mem: 1035788k total, 1018564k used, 17224k free, 296420k buffers
> Swap: 1052216k total, 8120k used, 1044096k free, 81360k cached
>
> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
> 10847 root 16 0 3632 948 756 R 0.7 0.1 0:00.07 top
> 3438 root 16 0 3940 580 492 S 0.3 0.1 0:17.43 nifd
> 3938 root 16 0 7756 4848 1612 S 0.3 0.5 1:11.28 hald
> 1 root 16 0 2756 560 480 S 0.0 0.1 0:00.82 init
> 2 root 34 19 0 0 0 S 0.0 0.0 0:00.08 ksoftirqd/0
> ...
>
> Why does it take almost all of 1Gb physical ram?
The kernel will attempt to use any available memory for buffering and
cacheing, as this makes things run faster. When applications need more
memory, buffer and cache space is released. So the figure you need to
look at in the "free" output is the one in the row marked "-/+
buffers/cache:", which shows memory usage not in buffers and cache; that
represents how much memory you're "really" using. In your example above,
the last run of "free" actually showed more free memory than the first
one.
Paul.
More information about the users
mailing list