【问题标题】:Is it possible to enable GuardMalloc and Zombie Objects while running an App from command line?从命令行运行应用程序时是否可以启用 GuardMalloc 和 Zombie Objects?
【发布时间】:2021-01-15 13:00:30
【问题描述】:

是否可以在从命令行运行应用程序时启用 GuardMalloc 和 Zombie Objects?

如果我可以在运行应用程序之前设置某种环境变量来启用这些?

【问题讨论】:

标签: xcode macos memory-management crash xcode-instruments


【解决方案1】:

NSZombies
您可以使用NSZombieEnabled 环境变量:NSZombieEnabled=YES

保护马洛克
DYLD_INSERT_LIBRARIES 环境变量设置为/usr/lib/libgmalloc.dylib。这告诉 dyld 使用 Guard Malloc 而不是标准版本的 malloc。有关详细信息,请参阅libgmalloc man page

您可以在此处找到其他 envars 来配置行为:Configuring the Malloc Environment Variables

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多