由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - Why my new or delete operator would fail?
相关主题
形参可以直接使用私有数据成员?请教 C++的一个困惑 (operator delete)
ask for help about AMD clusterC++ delete
valgrind to trace memory crash?求教new delete 在c++中的重载
a c++ question请叫一个 template class constructor 的问题
[合集] Memory leak的问题linux 能查到 deleted file list 吗
How to overload global new operator?[合集] An interview question, what is the answer? (转载)
one question about overloading operator deleteWhoCrashed v1.01 - post-mortem crashdump analysis.
one question about operator deleteInterview Question: System Crash
相关话题的讨论汇总
话题: operator话题: delete话题: my话题: new话题: why
进入Programming版参与讨论
1 (共1页)
b**n
发帖数: 289
1
Original program is too long here. My new operator sometimes gave me "
segmentation fault" from the following code:
double *ptr = new (nothrow) double [size]
assert(ptr);
And my delete operator some times just crashed my code. I used a new
operator to allocate memory, and then use delete to delete that chunk of
memory. But it still crashed.
I use g++-4.1 here.
Wish someone can give me some advice.
Many Thanks,
t****t
发帖数: 6806
2
use valgrind to check your program for memory corruption.

【在 b**n 的大作中提到】
: Original program is too long here. My new operator sometimes gave me "
: segmentation fault" from the following code:
: double *ptr = new (nothrow) double [size]
: assert(ptr);
: And my delete operator some times just crashed my code. I used a new
: operator to allocate memory, and then use delete to delete that chunk of
: memory. But it still crashed.
: I use g++-4.1 here.
: Wish someone can give me some advice.
: Many Thanks,

b**n
发帖数: 289
3
Thank you very much, thrust. valgrind helped me find the bug!
1 (共1页)
进入Programming版参与讨论
相关主题
Interview Question: System Crash[合集] Memory leak的问题
超牛的debugHow to overload global new operator?
有什么工具可以检查内存泄漏么one question about overloading operator delete
a g++ new exceptions questionone question about operator delete
形参可以直接使用私有数据成员?请教 C++的一个困惑 (operator delete)
ask for help about AMD clusterC++ delete
valgrind to trace memory crash?求教new delete 在c++中的重载
a c++ question请叫一个 template class constructor 的问题
相关话题的讨论汇总
话题: operator话题: delete话题: my话题: new话题: why