public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Jemalloc under CYGWIN
Date: Wed, 21 Oct 2015 10:53:00 -0000	[thread overview]
Message-ID: <20151021105300.GN5319@calimero.vinschen.de> (raw)
In-Reply-To: <CAJygYd1tU+Nc5+owTw0Lfuk8SWQQS2vE1mhKjoz5br4c9zVF8A@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1432 bytes --]

On Oct 16 23:56, Yucong Sun wrote:
> Hi,
> 
> Throught some frustrating and furious debugging I now understand the
> core issue here.  CYGWIN calls malloc provided by jemalloc during
> initializations,  which in turn calls pthreads functions, which in
> turn uses malloc, which also uses pthreads, causing a deadlock.
> 
> Now,  is there anyway to workaround this issue?

Not quickly, at least.  I looked into thread.cc and pthread.cc and
only found two uses of malloc, one of them should only occur when
pthread_exit'ing the main thread, the other in pthread_getattr_np.
The first shouldn't matter to jemalloc (or, does it?), the second
one I just eliminated.

What exactly is the malloc problem you're seeing?

In the long run it would be very nice if we could get jemalloc working
as the default malloc implementation in Cygwin, replacing dlmalloc.
This would allow to get rid of the slow global locking in malloc_wrapper.cc.

Historical note: At one point I tried to integrate ptmalloc3, but it
always had some unwanted side-effects and fixing them would have been
very complicated at the time.


So, if you're looking into getting jemalloc into Cygwin, feel free
to discuss this further on the cygwin-developers mailing list.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-10-21 10:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-07 11:18 Yucong Sun
2015-10-16 15:57 ` Yucong Sun
2015-10-21 10:53   ` Corinna Vinschen [this message]
2015-10-21 13:50     ` Yucong Sun
2015-10-21 14:15       ` Yucong Sun
2015-10-21 14:16       ` Corinna Vinschen
2015-10-21 15:40         ` Yucong Sun
2015-10-21 16:06           ` Corinna Vinschen
2015-11-26  9:34             ` Corinna Vinschen
     [not found]               ` <CAJygYd232P=HQVufwQKtU37hHDiJZO5gzpM7fPKndLGMycJBgw@mail.gmail.com>
2015-12-05 14:32                 ` Yucong Sun
2015-12-05 17:05                   ` Andrey Repin
2015-12-06 14:08                   ` Corinna Vinschen

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=20151021105300.GN5319@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).