Re: [squid-users] possible memory leak

From: Chris Robertson <crobertson@dont-contact.us>
Date: Thu, 01 Nov 2007 23:00:53 -0800

rihad wrote:
> Chris Robertson wrote:
>> rihad wrote:
>>> Squid using almost twice as much memory as was accounted for
>>> (according to top(1)):
>>> 4243 squid 29 20 0 1325M 1317M kserel 42:39 0.00%
>>> squid
>>>
>>> Is this expected?
>>>
>>
>>> From
>> http://wiki.squid-cache.org/SquidFaq/SquidMemory#head-0b5e485f61e7ea4e580c60f45177f0bbcf7d7b80
>>
>>
>> ....Additionally, most operating systems do not allow processes to
>> shrink in size. When a process gives up memory by calling /free/, the
>> total process size does not shrink. So the process size really
>> represents the maximum size your Squid process has reached.
>>
>
> It shouldn't have reached this much in the first place.

As noted down below, this amount of memory utilization is expected.

>
> > ....As a rule of thumb on Squid uses approximately 10 MB of RAM per GB
>> of the total of all cache_dirs (more on 64 bit servers such as
>> Alpha), plus your cache_mem setting and about an additional 10-20MB.
>>
>> 300 + (50 * 10) + (50 * 10) + 20 = 1320. That about covers it.
>>
>
> Please note carefully that in my email I was comparing top's output to
> cachemgr's:
>
> 4243 squid 29 20 0 1325M 1317M kserel 42:39 0.00% squid
> Total accounted: 763252 KB
>
> and asking if the difference was to be expected, or there could be
> some memory leak of some sort. Even though Squid does not account for
> every possible byte of memory, about twice as much is way too much, as
> Henrik once noted.

I noted that the first time. I'll try to be more clear. Top is showing
the max used (1320). Given the total size of your cache directories
(100GB total, at 10MB memory used per GB) that's 1000MB of memory usage
plus the 300MB you've explicitly set for cache_mem, plus another 20MB
for overhead, the max memory Squid is going to use is around 1320MB (as
shown in top). When you checked cachemgr, squid was not (at that
moment) using all of that memory, but your OS does not allow the process
to shrink in size. Hence, Squid was currently using about half of where
it maxed out, but was allocated the maximum that it had ever used.

A leak would indicate that Squid doesn't stop growing. The usage you
are indicating is both finite and accounted for.

Chris
Received on Fri Nov 02 2007 - 01:02:08 MDT

This archive was generated by hypermail pre-2.1.9 : Sat Dec 01 2007 - 12:00:01 MST