c******n 发帖数: 4965 | 1 又一个衰人写的程序, 要拿来用,
出segfault
我就拼命查,
gdb where 出来看居然事malloc() 自己segfault
library 怎么会出错那???
幸好有另外一个地方出绰,一个文件名最后的一个子母
编成乱码了,
怎么会这样呢? 就在程序里加了一个全程变量,
进入,stop,
set my_new_var=changed_char_of_filename
然后watch my_new_var
结果是那个malloc() 开到了filename 上了,
再一看,这个衰人给filename 最开始malloc() 的地方缺\000
ft to death
then afterwards, got another strange segfault with malloc()
this time I have not idea who was writing into unallocated space,
so I had to use valgrind,
it was pretty cool, turns out it was the same stupid err | c********e 发帖数: 383 | 2 u mean he malloced one char less then needed?
【在 c******n 的大作中提到】 : 又一个衰人写的程序, 要拿来用, : 出segfault : 我就拼命查, : gdb where 出来看居然事malloc() 自己segfault : library 怎么会出错那??? : 幸好有另外一个地方出绰,一个文件名最后的一个子母 : 编成乱码了, : 怎么会这样呢? 就在程序里加了一个全程变量, : 进入,stop, : set my_new_var=changed_char_of_filename
| s*******b 发帖数: 106 | 3 malloc won't give Segmentation fault?
I debugged a program just recently. That program gave segmentation fault
shortly after start. Finally, I tracked down to 1 MALLOC call. That MALLOC is
inside a loop. When that malloc is called the 4th time, I got a segmentation
fault. By the way, that program uses lots of memory when it starts, like
server hundred MBs. And that Linux box doesn't have a lot of memory on it.
After I killed everything I can on that box to get more memory out of it, the
segmenat
【在 c******n 的大作中提到】 : 又一个衰人写的程序, 要拿来用, : 出segfault : 我就拼命查, : gdb where 出来看居然事malloc() 自己segfault : library 怎么会出错那??? : 幸好有另外一个地方出绰,一个文件名最后的一个子母 : 编成乱码了, : 怎么会这样呢? 就在程序里加了一个全程变量, : 进入,stop, : set my_new_var=changed_char_of_filename
| a**a 发帖数: 416 | 4 Must be some memory corrupted.
【在 s*******b 的大作中提到】 : malloc won't give Segmentation fault? : I debugged a program just recently. That program gave segmentation fault : shortly after start. Finally, I tracked down to 1 MALLOC call. That MALLOC is : inside a loop. When that malloc is called the 4th time, I got a segmentation : fault. By the way, that program uses lots of memory when it starts, like : server hundred MBs. And that Linux box doesn't have a lot of memory on it. : After I killed everything I can on that box to get more memory out of it, the : segmenat
| s*******b 发帖数: 106 | 5 I thought that myself. But it's still during that program's start-up process.
That program hasn't done anything real yet. It's still trying to set up
everything needed to run. Memory corrupted already during start up? Hmm... I
hope not....
is
segmentation
the
【在 a**a 的大作中提到】 : Must be some memory corrupted.
| l*****t 发帖数: 2019 | 6 偶滴神呀,幸亏改行不用写这种东东
【在 c******n 的大作中提到】 : 又一个衰人写的程序, 要拿来用, : 出segfault : 我就拼命查, : gdb where 出来看居然事malloc() 自己segfault : library 怎么会出错那??? : 幸好有另外一个地方出绰,一个文件名最后的一个子母 : 编成乱码了, : 怎么会这样呢? 就在程序里加了一个全程变量, : 进入,stop, : set my_new_var=changed_char_of_filename
| f******y 发帖数: 2971 | 7 很可能是机器内存不足啊,你自己已经说了。
可以用new,再handle exception。
process.
I
【在 s*******b 的大作中提到】 : I thought that myself. But it's still during that program's start-up process. : That program hasn't done anything real yet. It's still trying to set up : everything needed to run. Memory corrupted already during start up? Hmm... I : hope not.... : : is : segmentation : the
|
|