a mistake
所在版块:求学狮城 发贴时间:2005-10-30 15:21

用户信息
复制本帖HTML代码
高亮: 今天贴 X 昨天贴 X 前天贴 X 
2nd case:
double * darray = new double[1];
should be:
double * darray = new double[2];

double[1] needs only 8 bytes, so first chunk (released when you delete flag) is reused.

change double[2] still does not generate segfault.

.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!

 相关帖子 我要回复↙ ↗回到正文
why does not "g++ -Wall" give warning message when compiling the following code? icky   (660 bytes , 932reads )
delete array; not delete [] array; simon   (470 bytes , 648reads )
do u mean icky   (132 bytes , 387reads )
no la...as simon said, object vs primitive data type sarah   (0 bytes , 390reads )
。。。。。。ok... simon   (0 bytes , 288reads )
different btw 'object' and 'primitive data type' simon   (0 bytes , 343reads )
using linux/glibc? Segfault because you damaged the link list hash   (1304 bytes , 650reads )
a mistake hash   (233 bytes , 410reads )
but after icky   (103 bytes , 385reads )
The default libstdc++ operator new and delete use the libc malloc and free. hash   (86 bytes , 464reads )