【问题标题】:OSX how can I debug malloc errors when extending python with C++?OSX 使用 C++ 扩展 python 时如何调试 malloc 错误?
【发布时间】:2015-10-11 19:14:29
【问题描述】:

我通过创建 C++ 包装器来扩展 python,以使用 C++11 编码的已建立库。当我测试我的代码时,我收到以下错误:

python(46809,0x7fff728e7300) malloc: *** mach_vm_map(size=140735135109120) failed (error code=3)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
python(46809,0x7fff728e7300) malloc: *** error for object 0x7fff73bc4c70: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

我已经探查了这段代码,并确认这是在预编译的外部库中发生的。 valgrind 的输出没有用,-fsanitize=address 标志会导致此错误:Symbol not found: ___asan_option_detect_stack_use_after_return。谁能推荐我在调试此内存泄漏时可以采用的新方法?

【问题讨论】:

  • 我更新了我的评论,以反映我的包装器是 C++,编译的库是 C++11。感谢您的评论:)

标签: python c++ macos memory-leaks malloc


【解决方案1】:

升级到 Mavericks 解决了这个问题。显然升级重写了一些重要的/System 文件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多