Date: Fri, 9 Feb 2018 10:00:26 -0500 From: Rich Felker <dalias@...c.org> To: musl@...ts.openwall.com Subject: Re: [RFC] malloc + threads = memleak? On Fri, Feb 09, 2018 at 04:33:38PM +0200, Roman Yeryomin wrote: > Hello! > > I have a very easy reproducible memory leak here when using > malloc/free in two threads. > Attaching a simple test. > thread() here is calling pthread_create(): > https://github.com/yeryomin/liba/blob/master/liba.c#L181 > > Do I misunderstand something or is it a bug? > This can be avoided by wrapping malloc into locks but not sure if > that's the fix you want... I haven't looked at this in detail yet, but I suspect this is a known issue that I thought was hard to hit, and that you've just found a reliable way to reproduce. I'll investigate more in a bit. I think it may turn out to be impossible to fix without either making malloc noticably slower or overhauling the whole malloc implementation (which is planned but I'm not ready to do yet). Thanks for the report; this looks like it will be useful even if disappointing. Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.