c - 编译自定义 malloc.c 库时出现段错误

标签 c linux pointers struct malloc

我在库中唯一修改的是 malloc_chunk 结构。我刚刚向 malloc_chunk 结构添加了另一个变量。之后在编译时显示段错误。

malloc.c 库的一部分

/* -----------------------  Chunk representations ------------------------ */
struct malloc_chunk {
  size_t               prev_foot;  /* Size of previous chunk (if free).  */
  size_t               head;       /* Size and inuse bits. */
  size_t               fulan;
  struct malloc_chunk* fd;         /* double links -- used only if free.     */
  struct malloc_chunk* bk;

};

fulan 是我添加的变量。我无法弄清楚为什么我会遇到段错误。任何帮助表示赞赏:(

最佳答案

在 bk 之后添加了该字段并且有效 (y)

关于c - 编译自定义 malloc.c 库时出现段错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41899225/

相关文章:

c - 将局部变量的指针返回到 main() 函数

c - lapack dgels_ 段错误 11

c - 指向嵌套结构中的结构的指针

linux - Linux更新相同的用途

调用一个 free() 包装器 : dereferencing type-punned pointer will break strict-aliasing rules

c - 有没有在win7下用yacc和lex制作c编译器的工具?

.net - 单声道无法加载类型 'System.Diagnostics.Tracing.EventSource'

linux - 如何在bash中将结果转换为整数

c++ - 如何从指针访问数组?

我可以释放最初从另一个指针分配的内存吗?