[avahi] Memory consumption

Lennart Poettering lennart at poettering.net
Thu Apr 12 03:46:13 PDT 2012


On Wed, 11.04.12 17:41, Frank Lahm (franklahm at googlemail.com) wrote:

> >
> > 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. :(
> 
> Would it make sense to extend the Avahi API so that a parameter could
> be passed which is then used to call pthread_attr_setstacksize() for
> the thread?

As mentioned, this will only minimize address space, not memory
usage. Allocating a biggre stack comes at virtually no cost -- as long
as it is never accessed. Unless you turned off lazy allocation in Linux
chasing this allocation is a waste of time. You are chasing a ghost.

Have you turned off lazy allocation on Linux?

(Note that the event loop logic in avahi is fully abstracted, you can
implement your own logic, and run the stuff in your own thread with your
own parameters. AvahiThreadedPoll is just one implementation, but
nothing you actually have to use.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the avahi mailing list