[Gc] Status of gc on Mac OS X - gc_cpp issue
renaud.blanch at imag.fr
Thu Oct 5 05:48:41 PDT 2006
Le 5 oct. 06 à 02:53, Boehm, Hans a écrit :
> I think it's pretty clear why this shouldn't be happening:
> gc_cpp.cc defines an operator delete that calls GC_FREE.
> Apparently the standard operator delete is called instead of that
> one. According to the C++ standard (126.96.36.199), I believe the one
> in gc_cpp.cc should get called.
> Unfortunately, in order for this interface to work correctly,
> operators new and delete really need to be intercepted somehow.
> However, this is a brittle spot on several platforms. Alternate
> suggestions/patches are appreciated.
> It might be that in this case there is a linker option that changes
> the behavior?
After further investigation, this is an issue with shared library
Linking with gc shared libraries does not override the default
delete, whereas linking statically does.
For example :
g++ -o test_cpp tests/test_cpp.o -lgc -lgccpp -L./.libs
does not intercept delete but
g++ -o test_cpp tests/test_cpp.o .libs/libgc.a .libs/libgccpp.a
Maybe this should be reported as a gcc bug ?
I have not been able to find a workaround this, even using the
LD_PRELOAD environment variable.
For the record, here is my gcc version :
[sunset:~] blanch% gcc --version
i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
>> -----Original Message-----
>> From: gc-bounces at napali.hpl.hp.com
>> [mailto:gc-bounces at napali.hpl.hp.com] On Behalf Of Renaud Blanch
>> Sent: Wednesday, October 04, 2006 8:01 AM
>> To: gc at napali.hpl.hp.com
>> Subject: Re: [Gc] Status of gc on Mac OS X - gc_cpp issue
>> Le 29 sept. 06 à 15:01, Renaud Blanch a écrit :
>>> Le 28 sept. 06 à 23:02, Boehm, Hans a écrit :
>>>> 2) It looks like test_cpp is invoking the system free when it
>>>> The next step here would be to look at the stack trace
>> when the error
>>>> message is printed to see where the free call is coming
>> from. This
>>>> looks like a problem that's specific to the gc_cpp.h C++
>>>> probably related to replacing ::new and friends.
>>> Provided the patch above, make check reports "All 5 tests passed"
>>> when configured with --enable-threads=posix and --enable-cplusplus.
>>> However, there is still a bunch of line like this in the output :
>>> test_cpp(23980) malloc: *** Deallocation of a pointer not
>>> malloced: 0x4640f8; This could be a double free(), or free() called
>>> with the middle of an allocated block; Try setting environment
>>> variable MallocHelp to see tools to help debug
>> after looking at the stack trace, it seems that free call is
>> triggered at the end of test_cpp when deleting the
>> uncollectable As (tests/test_cpp.cc, line 264).
>> apparently, this is the only call to free.
>> any hints ?
>>>>> -----Original Message-----
>>>>> From: gc-bounces at napali.hpl.hp.com
>>>>> [mailto:gc-bounces at napali.hpl.hp.com] On Behalf Of Renaud Blanch
>>>>> Sent: Thursday, September 28, 2006 12:22 AM
>>>>> To: gc at napali.hpl.hp.com
>>>>> Subject: [Gc] Status of gc on Mac OS X running on intel proc ?
>>>>> I was successfully using gc6.8 on a PPC PowerBook and on
>> a dual G5
>>>>> Mac running Mac OS X version 10.4.
>>>>> I switched to an Intel dual core MacBook Pro a few weeks ago.
>>>>> Basic make check reports failures on Mac OS X while it
>> works fine on
>>>>> the same machine running linux (ubuntu with a SMP kernel).
>>>>> Has anybody reported similar problems or conversely
>> reported success
>>>>> in using the gc on intel (dual core) based machine
>> running Mac OS X
>>>>> In case it helps, you will find below the configure and
>> make check
>>>>> logs for gc6.8 & gc7.0alpha7 for both linux & Mac OS X runs.
>>>>> I will happily collaborate with people motivated to
>> provide patch to
>>>>> the gc in order to make it work for intel macs.
>>>>> If some body can point me in the right direction, and
>> give me some
>>>>> hints, I am also motivated to contribute !
>> Gc mailing list
>> Gc at linux.hpl.hp.com
> Gc mailing list
> Gc at linux.hpl.hp.com
mailto:renaud.blanch at imag.fr
More information about the Gc