简体   繁体   English

free() 上损坏的双链表

[英]corrupted double-linked list on free()

I successfully run my code in small data but when i tried large scaled data, it gives me我成功地在小数据中运行了我的代码,但是当我尝试大规模数据时,它给了我

"corrupted double-linked list:" “损坏的双链表:”

In small data, if I delete free() functions, error is disappeared and code works, but in large data whether i put free or not, code gives this error.在小数据中,如果我删除 free() 函数,错误就会消失并且代码可以工作,但是在大数据中,无论我是否免费,代码都会给出这个错误。

Creation of malloc and using free in my code as follows,创建 malloc 并在我的代码中使用 free 如下,

int **msgcount = malloc(partnum*sizeof(int*));
for(i=0; i<partnum; i++)
    msgcount[i] = malloc( partnum*sizeof(int));

...lots of code

for(i=0;i<partnum;i++)
{
   free(msgcount[i]);
}

This message comes from glibc and means that you faced a memory corruption or you doubly freed the same pointer.此消息来自 glibc,意味着您面临内存损坏或双倍释放同一指针。 Try to run under valgrind and find where's the corruption occurred.尝试在 valgrind 下运行并找出损坏发生的位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM