NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: jemalloc SEGV problem




On Nov 7, 2008, at 10:23 AM, Christos Zoulas wrote:

In article <515c64960811062111l2308407cve5adf4d70f16d75d%mail.gmail.com@localhost >,
Channa  <channa.kad%gmail.com@localhost> wrote:
Hi,
Yes i included
All these header files.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char *ptr;
ptr=malloc(10);
strcpy(ptr,"hello");
printf("%s\n",ptr);
return 0;
}

But i am not able to understand where exactly is the problem to use jemalloc.c

Since in the jemalloc.c code i have not modified much apart from the
things i mentioned in my prev mail.

Thanks in Advance,
Channagoud

2008/11/6 Christos Zoulas <christos%astron.com@localhost>:
In article <515c64960811060431g3f4301e3se4a52cb4183a5f95%mail.gmail.com@localhost >,
Channa  <channa.kad%gmail.com@localhost> wrote:
Hi,
I am using the jemalloc.c file for my own library i could successfully
build it.

But when i run a test cases  i am getting segmentation fault.

The stack trace is as below:
#0  0x4006c304 in arena_run_split () from
/home/channagoud/channagoud_work/ARM/GIT/jemalloc/sslibc/build/ lib//libsonyc.so
#1  0x4006cb6c in arena_run_alloc () from
/home/channagoud/channagoud_work/ARM/GIT/jemalloc/sslibc/build/ lib//libsonyc.so
#2  0x4006e8a4 in arena_malloc () from
/home/channagoud/channagoud_work/ARM/GIT/jemalloc/sslibc/build/ lib//libsonyc.so
#3  0x4006ea50 in malloc () from
/home/channagoud/channagoud_work/ARM/GIT/jemalloc/sslibc/build/ lib//libsonyc.so
#4  0x4007512c in __smakebuf () from
/home/channagoud/channagoud_work/ARM/GIT/jemalloc/sslibc/build/ lib//libsonyc.so
#5  0x4007ab08 in __swsetup () from
/home/channagoud/channagoud_work/ARM/GIT/jemalloc/sslibc/build/ lib//libsonyc.so
#6  0x400747e0 in __sfvwrite () from
/home/channagoud/channagoud_work/ARM/GIT/jemalloc/sslibc/build/ lib//libsonyc.so
#7  0x400757e8 in puts () from
/home/channagoud/channagoud_work/ARM/GIT/jemalloc/sslibc/build/ lib//libsonyc.so
#8  0x00008494 in main () at test.c:5

One thing to note here is that you are dying in the malloc() call from
the printf(), not the first one...

Anytime you generally crash in malloc it indicates you torched internal malloc structures. It's also almost always the case the crash happens much later the overwrite that caused it.

Way too much experience tracking these things down at work in multi- threaded programs :)

James



Home | Main Index | Thread Index | Old Index