malloc: 对象 0x1029249b0 的 *** 错误:未分配正在释放的指针
malloc: *** error for object 0x1029249b0: pointer being freed was not allocated
我正在尝试在带有xcode 3.2.6的mac OS X 10.6.8上编译一个包含-std=c++0x的程序。我用自制软件将我的 g++ 编译器升级到 g++-4.7。在我的制作文件中,我将行从:
CXX = g++
CXXFLAGS = -std=c++0x
LD = g++
LDFLAGS = -L.
自:
CXX = g++-4.7
CXXFLAGS = -std=c++0x
LD = g++-4.7
LDFLAGS = -L.
但是,此行不起作用:
$(CC) -c -Icore/include/ -Ianalysis/include -Ieventbuilders/include -Isimdut/include -Istyle/include $(CXXFLAGS) $< -o $@
所以我把它改成:
$(CXX) -c -Icore/include/ -Ianalysis/include -Ieventbuilders/include -Isimdut/include -Istyle/include $(CXXFLAGS) $< -o $@
现在一切都可以编译,但是当我运行文件时,出现以下错误:
tbmon(25203) malloc: *** error for object 0x1029249b0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap
有人可以告诉我我做错了什么吗?提前谢谢你!
程序中有一个错误,它在指针上调用free()
,而指针不是通过malloc()
获得的。或代码中触发此行为的其他一些与内存相关的错误。
制作您提供的文件与此问题无关。您必须修复程序代码。
只是将编译器从gcc更改为g++不应该导致free(3)
失败。您能否发布一个演示该问题的最小示例?
相关文章:
- 正在理解智能指针,但出现错误:未分配正在释放的指针
- 为什么这个 std::queue/指向结构的指针列表直到 List.Size() == 0 才释放内存?
- 如何在向量中释放指针?
- 在C++中释放内存期间,迭代器与指针有何不同
- 包含矢量指针的结构的内存释放问题
- 错误:malloc:对象 0x7f9edf504080 的 *** 错误:未分配正在释放的指针
- 错误:释放指针未分配在矢量模板类C 中
- 如何在指针初始化为数组的第一个索引后释放指针
- 如何释放指针树中的所有内存
- 从 std::align 中释放指针
- C :释放指针没有分配在课堂上
- 构造向量 C++ 后无法释放指针
- nullptr是否释放指针的内存
- C/C++ 通过调用引用或直接释放指针
- 分段释放指针向量的错误
- 有效地从指向对象本身释放指针
- 如何释放指针向量中的元素
- Sqlite c/c++api,负责从sqlite3_column_text中释放指针
- 释放指针后分配给指针
- 正在释放指针