From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2028 invoked by alias); 21 Oct 2015 10:53:08 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 2015 invoked by uid 89); 21 Oct 2015 10:53:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.4 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 X-HELO: calimero.vinschen.de Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 21 Oct 2015 10:53:02 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id 60FE3A807CB; Wed, 21 Oct 2015 12:53:00 +0200 (CEST) Date: Wed, 21 Oct 2015 10:53:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: Jemalloc under CYGWIN Message-ID: <20151021105300.GN5319@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Tnj+unmjHTqEM5y0" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2015-10/txt/msg00335.txt.bz2 --Tnj+unmjHTqEM5y0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1400 On Oct 16 23:56, Yucong Sun wrote: > Hi, >=20 > 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. >=20 > 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 --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --Tnj+unmjHTqEM5y0 Content-Type: application/pgp-signature Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJWJ26MAAoJEPU2Bp2uRE+gsasP/A+H9cLo66xCUofnY5UPy3Ne DhIVDsTLjg3fUh73Uq7IHvm47dKio78nN2Qw79knHzu8r5hvS/kfijRQ+Wzyo9dw NZzm9Usle5+hbd0jxA4TBTOdFM3EFGG8Q5MWHq2sqy0XE3/HXB14bY+roApwfiuS MmgzdhkPTqdEA7pzGlf7BdasX1DegCtaai83JRySlQ6hGuGM1HzuhrjARL8oxpye Ka6N21KH6QeBvpa3osISiDcf6dFoOSnEnYsuFTazlyy8dkRb/+E1lgRO+inkONPk I+63h0bVboTHUfhNlxYd9vNsG2Ixn9hyCD2z6q9aVqBcwbDRllDKP6bf+Ban9zRg n0dFePf/C0Y4cEWL3UnuX4RHU5ManJT0dWG8/3E4bCHS0zjV6EjrHtVslLTeaWiy vs/Q+xQYH4SNNzHLQ6EhwmWA9S4xfCXmnWUjly28uUPMP9uHDBmSJ11JfCxNUZDK +0PRdzb0RV7FbKfThqr8mh1MGnd71PIfbgfZgze56IBtA+HaWWoGknQvxWn7DcUv Toff4jA5OM2aACwpGCRUeYLDbsUQjOG3MbQkBahLTM0Fv3Syibxmbm9uBIdLfj11 PK4+3suwEqYw5PPVesEvqUmGeKKJaBjkemvLJf/SAHhFdeImrSCpjNfZFizLg6MP 6p6Zlx9/cRsRtodYywuH =m6bg -----END PGP SIGNATURE----- --Tnj+unmjHTqEM5y0--