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! |
|