This is the mail archive of the
mailing list for the Cygwin project.
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
- Date: Tue, 10 Jul 2012 18:51:01 +0200
- Subject: Re: Differences between C++ 'new' operator and 'malloc()' (NOT a C/C++ question)
- References: <email@example.com>
- Reply-to: sc dot cygwin dot com at zeusw dot org
> On Thu, Jul 5, 2012 at 9:36 AM, Claude SIMON <firstname.lastname@example.org>
>> Let's consider a Java native component which only calls a 'malloc(1)'.
>> 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
>> the opportunity to test the returned value, nor to use it. It's perhaps
>> Cygwin bug, or perhaps a JVM/JRE/JDK bug ; I don't know and I don't
>> (but if someone will make some investigation about that, I'm ready to
>> him or her if I can).
>> When you replace the 'malloc()' by the 'new' operator, then the
>> 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 :
There is a 'README' file with further explanations.
Claude SIMON (email@example.com)
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple