From: Roger Pau Monne <roger.pau@citrix.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: Andres Lagar-Cavilla <andreslc@gridcentric.ca>,
Ian Jackson <Ian.Jackson@eu.citrix.com>,
xen-devel <xen-devel@lists.xen.org>
Subject: Re: Libxenstore memory leak on static compile
Date: Wed, 12 Sep 2012 16:03:51 +0100 [thread overview]
Message-ID: <5050A457.7070201@citrix.com> (raw)
In-Reply-To: <1347461790.24226.56.camel@zakaz.uk.xensource.com>
Ian Campbell wrote:
> On Wed, 2012-09-12 at 14:44 +0100, Andres Lagar-Cavilla wrote:
>> When statically compiling libxenstore.a, the USE_PTHREAD define is not
>> applied. This results in cleanup_{pus/pop} being no-ops. cleanup_p*
>> are used throughout xs.c:read_message to free malloc'ed objects.
>>
>> In short, libxenstore.a will leak memory when reading xenstore
>> messages. OOM killer awaits.
>>
>> This could be solved by either turning on USE_PTHREAD for .a
>> compilation (which, N.B. will not actually link libpthread but instead
>> produce an object archive that needs to be eventually linked to
>> libpthread.so), or by replacing cleanup_p* by proper free calls.
>
> The reason for the non-pthreads static library was so that you could
> build tiny statically linked xenstore clients against tiny libcs (like
> uclibc) to have things small enough to fit in e.g. your installer initrd
> or in your "guest tools" package.
>
> It used to be that uclibc didn't have a pthreads library. Maybe this
> has changed though (Roger, CCd, would know).
Yes, uclibc added a pthread library back in 2002:
http://mailman.uclinux.org/pipermail/uclinux-dev/2002-March/007613.html
> We don't seem to use pthread_cleanup_push/pop very extensively, so I
> think using proper free calls is probably the way to go?
>
> Using that pthread facility as a cheap and nasty GC seems a bit wrong to
> me anyhow.
>
> Ian.
>
next prev parent reply other threads:[~2012-09-12 15:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-12 13:44 Libxenstore memory leak on static compile Andres Lagar-Cavilla
2012-09-12 14:56 ` Ian Campbell
2012-09-12 15:03 ` Roger Pau Monne [this message]
2012-09-12 15:09 ` Andres Lagar-Cavilla
2012-09-12 15:56 ` Ian Campbell
2012-09-13 14:33 ` Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5050A457.7070201@citrix.com \
--to=roger.pau@citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=andreslc@gridcentric.ca \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.