avatar
c*n
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
avatar
c*e
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

avatar
s*b
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

avatar
a*a
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

avatar
s*b
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.
avatar
l*t
6
偶滴神呀,幸亏改行不用写这种东东

【在 c******n 的大作中提到】
: 又一个衰人写的程序, 要拿来用,
: 出segfault
: 我就拼命查,
: gdb where 出来看居然事malloc() 自己segfault
: library 怎么会出错那???
: 幸好有另外一个地方出绰,一个文件名最后的一个子母
: 编成乱码了,
: 怎么会这样呢? 就在程序里加了一个全程变量,
: 进入,stop,
: set my_new_var=changed_char_of_filename

avatar
f*y
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

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。