朋友你好我使用malloc的错误代码是3096有一个问题:ç的malloc错误代码:3096个
malloc.c:3096:SYSMALLOC:断言`(old_top ==(((mbinptr) ((char *)&((av) - > bins [((1) - 1)* 2]))__builtin_offsetof(struct malloc_chunk,fd))))& & old_size == 0)|| ((unsigned long)(old_size)> =(unsigned long)((((_builtin_offsetof(struct malloc_chunk,fd_nextsize))+((2 *(sizeof(size_t)))-1)&〜((2 * (为size_t))) - 1)))& &((old_top) - >大小为0x1 &)& &((无符号长整数)OLD_END & pagemask)== 0)”失败。 中止
代码:
char *malloc_tab(char *str)
{
if ((str = malloc(1024)) == NULL)
return (NULL);
return (str);
}
int *malloc_tab_int(int *str)
{
int i;
i = 0;
if ((str = malloc(1024)) == NULL)
return (NULL);
while (i != 1024)
{
str[i] = 0;
i = i + 1;
}
return (str);
}
char **malloc_dim_tab(char **str)
{
int y;
y = 0;
if ((str = malloc(1024 * sizeof(*str))) == NULL)
return (NULL);
while (y < 200)
{
if ((str[y] = malloc(1024 * sizeof(**str))) == NULL)
return (NULL);
y = y + 1;
}
return (str);
}
任何帮助,请!
3096是不是错误代码,它是失败的断言的源代码行数当你看到foobar.c:1234的形式时,通常意味着foobar.c的1234行。 – Sneftel