delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/07/10/12:51:31

X-Recipient: archive-cygwin AT delorie DOT com
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
Message-ID: <f04272a0af1767f921ed51727a081a19.squirrel@zeusw.org>
In-Reply-To: <1341614850.23157.ezmlm@cygwin.com>
References: <1341614850 DOT 23157 DOT ezmlm AT cygwin DOT com>
Date: Tue, 10 Jul 2012 18:51:01 +0200
Subject: Re: Differences between C++ 'new' operator and 'malloc()' (NOT a C/C++ question)
From: "Claude SIMON" <sc DOT cygwin DOT com AT zeusw DOT org>
To: cygwin AT cygwin DOT com
Reply-To: sc DOT cygwin DOT com AT zeusw DOT org
User-Agent: SquirrelMail/1.4.21
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

NightStrike wrote:
> On Thu, Jul 5, 2012 at 9:36 AM, Claude SIMON <sc DOT cygwin DOT com AT zeusw DOT org>
> 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 DOT cygwin DOT com AT zeusw DOT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019