Why my new or delete operator would fail?# Programming - 葵花宝典
b*n
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,
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,