From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16817 invoked by alias); 25 Mar 2015 22:48:42 -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 16773 invoked by uid 89); 25 Mar 2015 22:48:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: Yes, score=5.3 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,KAM_COUK,KAM_FROM_URIBL_PCCC,SPF_PASS autolearn=no version=3.3.2 X-HELO: out.ipsmtp2nec.opaltelecom.net Received: from out.ipsmtp2nec.opaltelecom.net (HELO out.ipsmtp2nec.opaltelecom.net) (62.24.202.74) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Wed, 25 Mar 2015 22:48:37 +0000 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2CWAQB+OhNV/wVe0lUNT4dExSeCUgKCJwEBAQEBAYUSAQEEIw8BBVELGAICBSECAg8CRhMIAQG3P3CaIwEBAQcBAQEBAQEcgSGKAIR9FoJSgUUFjkKIIYR3j0qDR4IkHIFQgzIBAQE X-IPAS-Result: A2CWAQB+OhNV/wVe0lUNT4dExSeCUgKCJwEBAQEBAYUSAQEEIw8BBVELGAICBSECAg8CRhMIAQG3P3CaIwEBAQcBAQEBAQEcgSGKAIR9FoJSgUUFjkKIIYR3j0qDR4IkHIFQgzIBAQE Received: from 85-210-94-5.dynamic.dsl.as9105.com (HELO [127.0.0.1]) ([85.210.94.5]) by out.ipsmtp2nec.opaltelecom.net with ESMTP; 25 Mar 2015 22:48:33 +0000 Message-ID: <55133B41.80108@tiscali.co.uk> Date: Wed, 25 Mar 2015 23:28:00 -0000 From: David Stacey User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: cygwin@cygwin.com Subject: Re: static vs. shared linking References: <5510A9AB.7020607@tiscali.co.uk> <5511AF73.9070607@tiscali.co.uk> <20150325090453.GB3017@calimero.vinschen.de> <850E2E37-EA86-448E-9B9F-206C662E14E5@etr-usa.com> <55133295.1090105@tiscali.co.uk> In-Reply-To: <55133295.1090105@tiscali.co.uk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00461.txt.bz2 On 25/03/2015 22:11, David Stacey wrote: > On 25/03/2015 16:59, Warren Young wrote: >> If that makes the symptom disappear, I wonder if there’s some problem >> with a Cygwin *.exe owning a std::string that gets resized by a >> Cygwin *.dll. If so, that probably*is* a memory ownership >> coordination problem that affects Cygwin proper. > > In order to test your hypothesis about memory ownership, I'll create a > test that malloc(3)s some memory in the .exe and free(3)s it in a > shared library; Corinna showed that the crash was coming from an > abort() in free(). However, I can't believe it's that simple - you'd > think there would be dozens of programmes crashing for this reason. Indeed. I created a very simple test that alloc(3)s memory in main() and then free(3)s it in a shared library. That works fine. So there's more to it than that :-( Dave. // crash_library.h #ifndef CRASH_LIBRARY_H #define CRASH_LIBRARY_H extern void Crash(unsigned short *ptr); #endif // CRASH_LIBRARY_H // crash_library.cpp #include "crash_library.h" #include void Crash(unsigned short *ptr) { free(ptr); } // main.cpp #include "crash_library.h" #include int main() { unsigned short*ptr = (unsigned short*)malloc(sizeof(unsigned short)); Crash(ptr); return 0; } -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple