# segmentation fault - malloc_pages ( )



## premenjit009 (Sep 14, 2010)

Hi all,

I am getting a segmentation fault when trying to call 'malloc' from my code(stack trace given below).

Can someone tell me the reason for getting this crash? 

Regards,


```
----stack-trace----------
Program terminated with signal 11, Segmentation fault.

#0  0x88b330af in malloc_pages (size=<value optimized out>) at ../../../../src/bsd/lib/libc/stdlib/malloc.c:574

574             page_dir[index] = MALLOC_FIRST;

[New Thread 0x8880000 (LWP 100172)]

(gdb) bt

#0  0x88b330af in malloc_pages (size=<value optimized out>) at ../../../../src/bsd/lib/libc/stdlib/malloc.c:574

#1  0x88b333f1 in imalloc (size=6056076) at ../../../../src/bsd/lib/libc/stdlib/malloc.c:737

#2  0x88b34049 in pubrealloc (ptr=0x0, size=6056076, func=0x88b9ae09 " in malloc():") at ../../../../src/bsd/lib/libc/stdlib/malloc.c:1126

#3  0x88b34234 in __malloc (size=6056076) at ../../../../src/bsd/lib/libc/stdlib/malloc.c:1156
```


----------



## SirDice (Sep 15, 2010)

Without access to the source code it'll be tricky to debug.

Please post the source code that generates the segfault.


----------

