Why "Required kernel recording resources are in use by another document" error is thrown when I try to run Executable in Instruments->Allocations?
Asked Answered
O

2

6

But it works fine with Instruments->Time Profiler.

All the other documents are closed.

Am trying to find a tool to find how much memory is used by my c++ code.

Offhand answered 31/10, 2022 at 11:21 Comment(0)
C
18

You can fix this without disabling SIP by running the following command in zsh. It will sign your binary with the get-task-allow entitlement, which allows debugging.

codesign -s - -v -f --entitlements =(echo -n '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd"\>
<plist version="1.0">
    <dict>
        <key>com.apple.security.get-task-allow</key>
        <true/>
    </dict>
</plist>') <your executable>

Source: https://cocoaphony.micro.blog/2022/10/29/solving-required-kernel.html

Thanks to Mārtiņš Možeiko for pointing me toward this solution.

Carvelbuilt answered 9/11, 2022 at 15:53 Comment(3)
When I run this script, I get "syntax error near unexpected token `('" It doesn't like the paren here: =(echoUranous
It works for me if I save the xml as a file on disk, and then do codesign -s - -v -f --entitlements=entitle.xml /path/to/my/appUranous
After the signing, it still doesn't work.Magenta
G
1

You need to disable SIP to be able to profile memory https://developer.apple.com/documentation/security/disabling_and_enabling_system_integrity_protection?language=objc

Glossotomy answered 8/11, 2022 at 9:59 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.