From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4334 invoked by alias); 18 Jun 2009 15:14:16 -0000 Received: (qmail 4319 invoked by uid 22791); 18 Jun 2009 15:14:15 -0000 X-SWARE-Spam-Status: No, hits=0.6 required=5.0 tests=BAYES_50,J_CHICKENPOX_44,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from moutng.kundenserver.de (HELO moutng.kundenserver.de) (212.227.126.187) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 18 Jun 2009 15:14:07 +0000 Received: from velian01.fakt.lc (velian1.pool.technopark-bs.de [193.175.26.176]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0MKv5w-1MHJJT1E1i-0001Vr; Thu, 18 Jun 2009 17:14:03 +0200 Message-ID: <4A3A59BA.4070804@noltec.org> Date: Thu, 18 Jun 2009 15:14:00 -0000 From: Christian Nolte User-Agent: Thunderbird 2.0.0.21 (X11/20090320) MIME-Version: 1.0 To: abhishek desai CC: java@gcc.gnu.org Subject: Re: problem when mapping malloc to GC_malloc. References: <898285d30906180800q3b5bd3b2h1d4a11d6a8245e34@mail.gmail.com> In-Reply-To: <898285d30906180800q3b5bd3b2h1d4a11d6a8245e34@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact java-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-owner@gcc.gnu.org X-SW-Source: 2009-06/txt/msg00040.txt.bz2 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Abhishek, abhishek desai wrote: > My JNI code includes redefinitions to the malloc, free and realloc > functions (shown below). These functions call GC_malloc, GC_free and > GC_realloc respectively. This is done so that any calls to the malloc > get allocated through the garbage collector. I presume you are using Hans Boehm's garbage collector? If so, did you follow the instructions on: http://www.hpl.hp.com/personal/Hans_Boehm/gc/simple_example.html What platform are you developing for? If it is not Linux, you have to make sure that GC_INIT() is being called before using any of the GC_xxx functions. > However this is failing > with segfault. Any clues why this does not work ? > I am using this code along with the libgcj library linked dynamically > with my application. > > void *malloc(size_t size) > { > return GC_malloc(size); > } > > void *realloc(void *ptr, size_t size) > { > return GC_realloc(ptr, size); > } > > void free(void *ptr) > { > GC_free(ptr); > } Perhaps you can give us some more context. A simple, compilable example would be great to see where and how exactly you are using your redefinitions. Best regards, Christian - -- "He's an unconventional pirate paramedic with a mysterious suitcase handcuffed to his arm. She's a pregnant gypsy widow from aristocratic European stock. They fight crime!" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iEYEARECAAYFAko6WboACgkQCNjA0nfhW7xDYwCgpI3ntEEScbqbQOpCkfi1Z3KG lrQAoI8+xh/swyVSgREAMmjX1B8rIWFl =A/lO -----END PGP SIGNATURE-----