[avahi] Memory consumption

Frank Lahm franklahm at googlemail.com
Tue Apr 10 06:23:56 PDT 2012


Hi all,

I'm one of the Netatalk (OpenSource AFP fileserver) devs. We use Avahi
via avahi_threaded_poll and friends in order to register the AFP
server with mdns.
We call the Avahi setup stuff once in our main process `afpd` here
[1]. Handling user sessions is done by forking childs.

As it seems, when calling the Avahi setup functions, a big chunk of
memory is taken:

With Avahi registration:

$ s pmap 14083
14083:   /usr/local/netatalk/sbin/afpd -d -F /usr/local/netatalk/etc/afp.conf
0000000000400000    308K r-x--  /usr/local/netatalk/sbin/afpd
000000000064c000     24K rw---  /usr/local/netatalk/sbin/afpd
0000000000652000    116K rw---    [ anon ]
000000001fd34000    280K rw---    [ anon ]
000000004068d000      4K -----    [ anon ]
000000004068e000  10240K rw---    [ anon ]

Without Avahi registration:

$ s pmap 14233
14233:   /usr/local/netatalk/sbin/afpd -d -F /usr/local/netatalk/etc/afp.conf
0000000000400000    308K r-x--  /usr/local/netatalk/sbin/afpd
000000000064c000     24K rw---  /usr/local/netatalk/sbin/afpd
0000000000652000    116K rw---    [ anon ]
0000000015cc8000    280K rw---    [ anon ]

The difference is this 10 MB allocation:

000000004068e000  10240K rw---    [ anon ]

Obviously, we didn't bother calling the Avahi free ressources()
functions in the forked afpd session childs as the damage done by
sbrk() can't be undone by free().

The main concern I have with this memory consumption is that is handed
down to every afpd process.

My questions are:
- is the memory consumption of 10 MB as expected ?
- do you see any way of preventing the inheritance of the memory
consumption without running the Avahi registration in an dedicated
process ?

Thanks!
-f

[1] <http://netatalk.git.sourceforge.net/git/gitweb.cgi?p=netatalk/netatalk;a=blob;f=etc/afpd/afp_avahi.c;h=bbd95cad880b69add4af1913c0d7ab7e0a87567f;hb=HEAD>


More information about the avahi mailing list