这个问题已经在这里有一个答案:
- 面对一个错误“glibc的*** ***检测免费():无效的下一个尺寸(快速)” 2个回答
下面就打破了代码fclose()
调用。
void output_gauss_transform(char* filename, char* mode, double** T,
double shift, int len)
{
FILE* fp;
printf("Outputting gauss transform to %s.\n", filename);
if ((fp = fopen(filename, mode)) == NULL){
perror("Could not open file");
return;
}
int i;
for (i = 0; i < len; ++i) {
fprintf(fp, "%lf %lf\n", T[0][i], T[1][i] + shift);
}
if (fclose(fp)){
printf("error closing\n");
}
}
glibc
给了我这个错误,与存储器映射一起。
*** glibc detected *** [sourcedir]/.libs/lt-launcher: free(): invalid next size (normal): 0x0821da38 ***
======= Backtrace: =========
/lib/i386-linux-gnu/libc.so.6(+0x75ee2)[0xb739dee2]
/lib/i386-linux-gnu/libc.so.6(fclose+0x154)[0xb738d424]
/src/.libs/libfile_util.so.0(output_gauss_transform+0xa9)[0xb77b5859]
/src/.libs/lt-launcher[0x804a0f9]
/src/.libs/lt-launcher[0x804a2a5]
/src/.libs/lt-launcher[0x804983b]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0xb73414d3]
/src/.libs/lt-launcher[0x8049915]
当试图与调试此valgrind
,我拿不出任何错误,它输出以下。 到底是怎么回事?
==30396== HEAP SUMMARY:
==30396== in use at exit: 0 bytes in 0 blocks
==30396== total heap usage: 1,059 allocs, 1,059 frees, 78,149 bytes allocated
==30396==
==30396== All heap blocks were freed -- no leaks are possible
==30396==
==30396== For counts of detected and suppressed errors, rerun with: -v
==30396== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
编辑:运行valgrind
与-v
,我得到这个东西在最后。 也许它是与是怎么回事?
--31325-- REDIR: 0x454cac0 (operator delete(void*)) redirected to 0x402bb98 (operator delete(void*))