[avahi] Memory consumption

Lennart Poettering lennart at poettering.net
Wed Apr 11 08:44:50 PDT 2012


On Wed, 11.04.12 16:50, Frank Lahm (franklahm at googlemail.com) wrote:

> > I don't see where the Avahi client libraries cuould do such a big
> > allocation. My only guess is that this is actually the D-Bus library
> > that does this (it maintains a message cache). To figure this out it
> > might be worth to plot the memory usage with a tool like valgrind's
> > massif tool?
> 
> I had checked with Valgrind memcheck before to no avail. I've looked
> at massif as to your recommendation and that is indeed quite revealing
> (this requires the --pages-as-heap=yes option as the large allocation
> is apparently not done via malloc et al):

> So it seems it's pthread_create(). Wonder why it allocates such a huge
> chunk of memory. I guess the only way avoiding this is completely
> redesigning our application such that the Avahi stuff is not done in
> the process that later forks and runs user AFP sessions. :(

This might simply be the stack for the thread, which you can influence
with "ulimit -s" in its size.

However, note that having a large stack doesn't actually mean that this
uses a lot of memory, it just reserves address space, which is only
backed when needed. Hence, most likely this is really a
non-issue. (i.e. don't confuse reservation of memory with reservation of
address space!)

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the avahi mailing list