NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Memory leaks in c/pthread libraries

> On 6. Jun 2024, at 00:55, Greg Troxel <> wrote:
> Brian Marcotte <> writes:
>> Since upgrading to NetBSD-10, we've seen memory leaks in several
>> daemons which use libpthread:
> I am seeing the leak with gpg-agent and mariadbd.  I don't run the rest
> on 10.

For me it is spamass-milter.  On an amd64, 10.0, 56 days up:

  387 root      85    0    26G  236M poll/0      0:50  0.00%  0.00% spamass-mil

On amd64 a vsize of 26G is only nasty, on my i386 mail server the
milter dies every few days at ~2G :-)

I have a small test (p2.c, attached) that shows the leak.  It is
always a combination of pthread_create()/pthread_detach().  Using
pthread_join() instead of pthread_detach() doesn't have the problem.

All started with this commit:

Undoing part of this commit (diff attached) makes the leak disappear
for me.  I'm not sure if this is fix or it just plasters another bug,
I'm not very familiar with the lwp lifecycle.

At least I'm sure pthread__deadqueue fills with dead pthreads and
the mapped stacks are the memory leak observed.

J. Hannken-Illjes -

Attachment: p2.c
Description: Binary data

Attachment: 001_pthread_revert.diff
Description: Binary data

Attachment: signature.asc
Description: Message signed with OpenPGP

Home | Main Index | Thread Index | Old Index