Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macos: use "Main Thread Checker" sanitizer? #4188

Open
bnoordhuis opened this issue Oct 28, 2023 · 5 comments
Open

macos: use "Main Thread Checker" sanitizer? #4188

bnoordhuis opened this issue Oct 28, 2023 · 5 comments

Comments

@bnoordhuis
Copy link
Member

From https://developer.apple.com/documentation/xcode/diagnosing-memory-thread-and-crash-issues-early:

The Main Thread Checker tool dynamically replaces system methods that must execute on the main thread with variants that check the current thread. The tool replaces only system APIs with well-known thread requirements, and doesn’t replace all system APIs. Because the replacements occur in system frameworks, Main Thread Checker doesn’t require you to recompile your app.

And also:

Because Main Thread Checker doesn’t require you to recompile your code, you can run it on an existing macOS binary. Inject the dynamic library located at /Applications/Xcode.app/Contents/Developer/usr/lib/libMainThreadChecker.dylib into your executable.

@juanarbol
Copy link
Contributor

juanarbol commented Nov 19, 2023

Use the sanitizer, like, where? Could you please be a bit more specific? I can help w/ this one
I could work on this one, I just need a bit of time for it

@bnoordhuis
Copy link
Member Author

Investigating if - and if so, where - it makes sense to use is part of the task.

@juanarbol
Copy link
Contributor

I'm currently investigating. For now, besides 200 warnings about types and losing precision, and I don't see a lot of value

@juanarbol
Copy link
Contributor

Honestly. I don't see anything useful from this. I think -based on 10 mins reading- that is mostly for UI updates in SWIFT

Screenshot 2024-05-21 at 23 14 45

@juanarbol
Copy link
Contributor

Yes, I think it is for updates that must be called from the main thread.

https://developer.apple.com/documentation/xcode/diagnosing-memory-thread-and-crash-issues-early#Detect-improper-UI-updates-on-background-threads

The Main Thread Checker tool ensures that all calls that must occur on the main thread do so. To enable this tool, select Main Thread Checker from the Diagnostics section of the appropriate scheme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants