Re: Memory use... am I doing something wrong here?

From: Jonathan Larmour <[email protected]>
Date: Fri, 27 Jun 1997 15:16:22 +0100

At 16:28 26/06/97 -0400, Michael Pelletier wrote:
>In my squid.conf file, I have:
>
>cache_mem 64
>cache_mem_low 75
>cache_mem_high 90
[but sees:]
> PID USERNAME PRI NICE SIZE RES STATE TIME WCPU CPU COMMAND
> 252 root 2 4 123M 123M sleep 11:28 0.20% 0.20% squid
[and also said in a different message:]
>BTW, in the Cache Manager, I see the following:
>
>Accounted Memory Usage:
   [...]
       Total Accounted = 64387 KB
>
>So, that looks right... Maybe I have a memory leak?

On my system, I get:
Memory usage for squid via mallinfo():
        Total space in arena: 22201 KB
        Ordinary blocks: 21193 KB 4875 blks
        Small blocks: 0 KB 0 blks
        Holding blocks: 408 KB 2 blks
        Free Small blocks: 0 KB
        Free Ordinary blocks: 1007 KB
        Total in use: 21601 KB 97%
        Total free: 1007 KB 5%
[snip]
Accounted Memory Usage:
[...]
Pool for in-memory object 4099 x 4096 bytes = 16396 KB ( 7996 free)
[...]
        Total Accounted = 20401 KB

and:
  PID USER PRI NI SIZE SWAP RSS SHARE STAT %CPU %MEM TIME COMMAND
30279 squid 1 0 22992 20920 2072 384 S 6.1 6.6 25:46 squid

Also, note the following in squid.conf:
# The value of cache_mem is an upper limit on the size of the
# "in-memory object data" pool. This is a pool of 4k pages used
# to hold object data.

So cache_mem only applies to the in-memory object data, and _not_ the
total. So your total will always be much more than cache_mem. Also the info
from mallinfo() shows there are inefficiences (which will inevitably be
there). For the factor of 2 difference that you get, it is possible your
malloc implementation isn't very good. Do you have mallinfo() on your
system (its automatically used by cachemgr if it is)?

Perhaps you could try compiling squid with GNUmalloc.

Jonathan L.

Origin UK,323 Cambridge Science Park,Cambridge,England. Tel: +44(1223)423355
------[ Do not think that every sad-eyed woman has loved and lost... ]------
April 12th! Ra!Ra!----[ she may have got him. -Anon ]-----April 12th! Ra!Ra!
Help fight spam! http://spam.abuse.net/ These opinions are all my own fault
Received on Fri Jun 27 1997 - 07:27:17 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:35:35 MST