On Sat, 2009-01-17 at 16:55 -0800, [email protected] wrote:
> On Sat, 17 Jan 2009, Michael Biebl wrote:
> 
> > Hi,
> >
> > I'm running rsyslog 3.20.2
> >
> > I noticed the following:
> > # /etc/init.d/rsyslog restart
> > VSZ    RSS (as reported by ps)
> > 27100 1184
> > # logger foo
> > 27100 1196
> > # logger foo (1000x)
> > 27100 1200
> > # logger foo (1000x)
> > 27100 1204
> > # logger foo (1000x)
> > 27100 1208
> >
> > and so on.
> >
> >
> > This made me wonder, if rsyslog is leaking memory somewhere.
> 
> I have run rsyslog through stress tests where I have sent it 1B log 
> messages and do not think that there is a memory leak.

I am using valgrind's excellent memory debugger routinely during
development. That brings up leaks and invalid memory access rather
quickly. In fact, code quality has much improved when I started to use
valgrind routinely roughly a year ago. From time to time I also do
specific tests for leaks, both using valgrind and the traditional
analysis technics.

>From what I have seen so far, I, too, doubt there is a leak. However,
there are various levels of testing. For example, the postgres output
module and the GSSAPI code is contributed and I do not even have a test
environment. So these are not checked using that procedure. The libdbi
code is only checked every now and then and not with all backends (e.g.
no Oracle at hand ... and so on...). If I ever get over to a full
testing suite (no collaborators found so far...), I'll probably be able
to do more consitent testing of all modules.

> 
> what I think that you are seeing is that the default rsyslog memory queue 
> only uses as much ram as it needs to hold the data (even though it's 
> described as a array it seems to grow dynamicly, I'm not sure about it 
> shrinking)

If you use "fixedarray" mode, the pointer array is allocated statically,
no matter how many messages are in the queue. HOWEVER, this is only the
pointers, so quite few memory. Actual messages are dynamically allocated
and freed when processed - in any mode.

> 
> when you log a bunch of messages via logger you push data into the array 
> faster then it gets extracted, so it takes more memory (up until you hit 
> the max size of the array, which I think is 1000 entries)
> 
> > I also noticed, that for each loaded module, rsyslog resevers exactly
> > 8 Mb of anoymous memory (pmap -d `pgrep rsyslog`)
> > With a couple of loaded modules you easily get over 50Mb VSZ.
> 
> I haven't tried doing stuff with different modules, so I don't know about 
> this.

I am not sure where it comes from, but I'd think into the dlload
direction. Could also very well be the runtime stack for each thread
(not dug into the details).

Rainer

_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com

Reply via email to