From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22135 invoked by alias); 10 Jul 2012 16:51:22 -0000 Received: (qmail 22116 invoked by uid 22791); 10 Jul 2012 16:51:19 -0000 X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL,BAYES_00,FSL_RCVD_USER,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from smtp2-g21.free.fr (HELO smtp2-g21.free.fr) (212.27.42.2) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 10 Jul 2012 16:51:06 +0000 Received: from www.zeusw.org (unknown [82.231.68.224]) by smtp2-g21.free.fr (Postfix) with ESMTP id 054D54B0097 for ; Tue, 10 Jul 2012 18:50:58 +0200 (CEST) Received: from localhost ([::1] helo=zeusw.org) by www.zeusw.org with esmtp (Exim 4.72) (envelope-from ) id 1SodeP-0005mp-54 for cygwin@cygwin.com; Tue, 10 Jul 2012 18:51:01 +0200 Received: from 192.168.5.10 (SquirrelMail authenticated user esc) by zeusw.org with HTTP; Tue, 10 Jul 2012 18:51:01 +0200 Message-ID: In-Reply-To: <1341614850.23157.ezmlm@cygwin.com> References: <1341614850.23157.ezmlm@cygwin.com> Date: Tue, 10 Jul 2012 16:51:00 -0000 Subject: Re: Differences between C++ 'new' operator and 'malloc()' (NOT a C/C++ question) From: "Claude SIMON" To: cygwin@cygwin.com Reply-To: sc.cygwin.com@zeusw.org User-Agent: SquirrelMail/1.4.21 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit 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 X-SW-Source: 2012-07/txt/msg00140.txt.bz2 NightStrike wrote: > On Thu, Jul 5, 2012 at 9:36 AM, Claude SIMON > wrote: >> Let's consider a Java native component which only calls a 'malloc(1)'. >> It >> doesn't even test the returned value (it is usually not a good idea, but >> it doesn't matter here). >> >> This component : >> - compiled with g++ under Linux : works, >> - compiled with g++ under Mac OS : works, >> - compiled with Visual C++ under Windows : works, >> - compiled with g++ under Cygwin : CRASHES ! >> >> It crashes as soon the 'malloc(1)' function is called. You don't even >> have >> the opportunity to test the returned value, nor to use it. It's perhaps >> a >> Cygwin bug, or perhaps a JVM/JRE/JDK bug ; I don't know and I don't >> bother >> (but if someone will make some investigation about that, I'm ready to >> help >> him or her if I can). >> >> When you replace the 'malloc()' by the 'new' operator, then the >> component >> compiled with g++ under Cygwin works too. > > > Can you provide a reduced self contained small test case that > demonstrates the problem? That'll be your fastest path to a > resolution. It's also the easiest way to explain what you are seeing. > Thanks for your interest. I've made a test case which can be found at : http://cvs.savannah.gnu.org/viewvc/epeios/bugs/jcmc/?root=epeios There is a 'README' file with further explanations. -- Claude SIMON (sc.cygwin.com@zeusw.org) -- 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