problem with malloc() in a child-process ...
From: Marc Eilhard (marc.eilhard_at_forst.uni-goettingen.de)
Date: 08/30/04
- Next message: Marc Eilhard: "Re: problem with malloc() in a child-process ..."
- Previous message: QNils_O=2E_Sel=E5sdal=22?=: "Re: gcc and some static libs"
- Next in thread: Marc Eilhard: "Re: problem with malloc() in a child-process ..."
- Reply: Marc Eilhard: "Re: problem with malloc() in a child-process ..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 30 Aug 2004 11:04:42 +0200
Hi there,
i have a problem with malloc() in a process.
Here is a snippet:
-----<snip>----------<snip>----------<snip>----------<snip>----------<snip>-----
66 int io_send(int sock, IO_FLAG flag, const char* msg, int size)
67 {
68
69 char* buf = NULL;
70 fprintf(stderr, "sending ...\n" );
71
72 /* buf is as long as complete size (4 Bytes) + flag (4
Bytes) + data ( 'size' Bytes ) */
73 int buf_size = size+9;
74
75 buf = (char*) malloc(buf_size);
-----<snip>----------<snip>----------<snip>----------<snip>----------<snip>-----
io_send is called out of a child-process. The first time it works fine but
after that
gdb says:
-----<snip>----------<snip>----------<snip>----------<snip>----------<snip>-----
76 buf = (char*) malloc(buf_size);
(gdb) n
Program received signal SIGSEGV, Segmentation fault.
0x4017bede in mallopt () from /lib/tls/libc.so.6
-----<snip>----------<snip>----------<snip>----------<snip>----------<snip>-----
here is the backtrace:
-----<snip>----------<snip>----------<snip>----------<snip>----------<snip>-----
(gdb) bt
#0 0x4017bede in mallopt () from /lib/tls/libc.so.6
#1 0x0804859f in ?? ()
#2 0x4011219c in ?? () from /lib/tls/libc.so.6
#3 0x69656c6b in ?? ()
#4 0x4023f888 in __after_morecore_hook () from /lib/tls/libc.so.6
#5 0xbffffab0 in ?? ()
#6 0x4023f840 in __after_morecore_hook () from /lib/tls/libc.so.6
#7 0x0804b048 in ?? ()
#8 0x00000050 in ?? ()
#9 0x4023f840 in __after_morecore_hook () from /lib/tls/libc.so.6
#10 0x4023eebc in ?? () from /lib/tls/libc.so.6
#11 0x4023f840 in __after_morecore_hook () from /lib/tls/libc.so.6
#12 0x00000001 in ?? ()
#13 0x00000045 in ?? ()
#14 0x4017b11d in malloc () from /lib/tls/libc.so.6
#15 0x4023f840 in __after_morecore_hook () from /lib/tls/libc.so.6
#16 0x00000045 in ?? ()
#17 0x00000000 in ?? ()
#18 0x40240190 in timezone () from /lib/tls/libc.so.6
#19 0xbffffab0 in ?? ()
#20 0xbffff9b8 in ?? ()
#21 0x080493b8 in io_send (sock=Cannot access memory at address 0x12
) at src/IOFunctions.cpp:76
-----<snip>----------<snip>----------<snip>----------<snip>----------<snip>-----
i am working with debian 3.0 and gcc 3.3.4
Any idea what is going wrong here ?
Thank you!
-- Marc Eilhard Institut für Forstliche Biometrik und Informatik Universität Göttingen Büsgenweg 4, 37077 Göttingen Tel.: 0551 39-12109 icq: 136978363
- Next message: Marc Eilhard: "Re: problem with malloc() in a child-process ..."
- Previous message: QNils_O=2E_Sel=E5sdal=22?=: "Re: gcc and some static libs"
- Next in thread: Marc Eilhard: "Re: problem with malloc() in a child-process ..."
- Reply: Marc Eilhard: "Re: problem with malloc() in a child-process ..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|