From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15460 invoked by alias); 18 Jun 2009 15:00:14 -0000 Received: (qmail 15451 invoked by uid 22791); 18 Jun 2009 15:00:13 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_44,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-qy0-f194.google.com (HELO mail-qy0-f194.google.com) (209.85.221.194) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 18 Jun 2009 15:00:04 +0000 Received: by qyk32 with SMTP id 32so1431681qyk.0 for ; Thu, 18 Jun 2009 08:00:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.99.137 with SMTP id u9mr307056qcn.89.1245337202055; Thu, 18 Jun 2009 08:00:02 -0700 (PDT) Date: Thu, 18 Jun 2009 15:00:00 -0000 Message-ID: <898285d30906180800q3b5bd3b2h1d4a11d6a8245e34@mail.gmail.com> Subject: problem when mapping malloc to GC_malloc. From: abhishek desai To: java@gcc.gnu.org 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/msg00039.txt.bz2 Hi, 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. 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); } regards abhishek