On Sep 14, 2004, at 23:38, Fajar A. Nugraha wrote:

Nigel Horne wrote:

On Tuesday 14 Sep 2004 10:34, D Walsh wrote:


Would you consider the following a sign of a memory leak?

ID name user cpu threads real mem virtual mem
--------------------------------------------------------------------- --- ----------------------------
1899 freshclam clamav 0.00 1 316.00 KB 27.12 MB
1 hour later
1899 freshclam clamav 0.00 1 316.00 KB 27.12 MB 1901 clamd clamav 0.00 2 19.28 MB 40.37 MB
1 hour later
1901 clamd clamav 0.00 1 19.28 MB 39.86 MB

No, since internally the code could have called "free()", but that doesn't necessarily
mean that the memory is released to the operating system.



Okay. So here's the problem now.
On my system (Solaris9) "top" shows these values :

Memory: 1024M real, 169M free, 3464M swap in use, 3378M swap free

  PID USERNAME LWP PRI NICE  SIZE   RES STATE    TIME    CPU COMMAND
12406 exim       9  59    0   51M   17M sleep   18.8H 14.06% clamd

RES shows clamd uses 17M of memory, which is about right.
SIZE shows a greater value (51M), which is still normal.
I assume it's because the "free()" doesn't immediately return memory to the OS.
The PROBLEM is that on some occations SIZE reached over 3GB, RES stays at 17-21M,
but the memory is never returned to the OS (e.g. new processes will complain "out of memory"
or "no stack space available"). If I kill clamd at that point, all returns to normal.

Well, I must admit the following.

I sat down in front of a Solaris 9 system, installed clamav as instructed and yes indeed there appears to be a problem with the implementation of free(), in 30 mins of sending e-mail from the EICAR test site memory did climb to 2.87gb and did not clear itself.

I disconnected it from the network to stop further communication in an attempt to clear memory but it's been an hour and it has not decreased.

While I was waiting, I installed Solaris 8 on another system, ran the same tests and while memory did hit 2.47gb, within 5 mins it returned to 48mb.

This leads me to believe that the problem is occurring in Solaris 9 due to changes in the OS itself and perhaps clamav should consider using a different avenue with this OS.

Aside from that, all I can tell you is I'm not impressed with this OS and I guess I prefer the Darwin/FreeBSD environment because I'm used to it, know what tools are available and can muck around with some confidence without blowing things up.

Which brings my earlier suggestion. Is there any way to put a built-in memory limiter
(not external program like softlimit) to clamd?


MySQL's mysqld is a good example on how memory limitation is used. It has some
paramaters, which controls memory usage. On crashes, it shows how much (max) memory
it can use (something like
"key_buffer_size=8388600
read_buffer_size=131072
max_used_connections=1
max_connections=100
threads_connected=2
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 225791 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
")
And based on my experince, it never uses over that amount of memory.
MySQL's mysqld_safe script is also a good example on how it can automatically
restarts the daemon.


The point is, I understand that clamd sometimes need a lot of memory, and the high memory usage
on SIZE may not be leak at all, but some of us have very limited amount of memory and swap file,
and would like some mechanism to limit clamd's memory usage.


Sure, softlimit + svc works fine. But it will be even better if clamd has the limitation built-in.

Regards,

Fajar


------------------------------------------------------- This SF.Net email is sponsored by: thawte's Crypto Challenge Vl Crack the code and win a Sony DCRHC40 MiniDV Digital Handycam Camcorder. More prizes in the weekly Lunch Hour Challenge. Sign up NOW http://ad.doubleclick.net/clk;10740251;10262165;m _______________________________________________ Clamav-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/clamav-users




------------------------------------------------------- This SF.Net email is sponsored by: thawte's Crypto Challenge Vl Crack the code and win a Sony DCRHC40 MiniDV Digital Handycam Camcorder. More prizes in the weekly Lunch Hour Challenge. Sign up NOW http://ad.doubleclick.net/clk;10740251;10262165;m _______________________________________________ Clamav-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/clamav-users

Reply via email to