This library for iOS acts as a watchdog for activities on the Core Audio thread that are considered unsafe:
It works by overriding a number of system functions, including
objc_msgSend (for 64-bit devices and the 64-bit simulator only, for now),
write, etc. When a call is intercepted, a warning is printed to the console. You can also put a breakpoint on
It won’t catch everything, and it won’t catch anything in Apple’s own system code, but it’ll catch some locks, some memory allocation, all Objective-C use (but not Swift), all object retains, and some common IO tasks, in your code and that of any static libraries you’re using.
This library is also built into The Amazing Audio Engine 2.
With Cocoapods: add the "
RealtimeWatchdog" pod to your Podfile, and call
pod install. Done!
If you get any errors about implicit depedencies, you may also need to open the "Target Dependencies" item, and add RealtimeWatchdog there.
You can easily disable the monitor by commenting out the
#define REALTIME_WATCHDOG_ENABLED 1 line in
It will only be active for debug builds, so you can leave it on safely.
Note that for 64-bit devices and the 64-bit simulator, this library provides its own wrapper implementation of
objc_msgSend, which means Objective-C method calls will be marginally slower.
For more discussion on realtime thread safety, see this article: Four common mistakes in audio development.
Copyright (C) 2012-2016 A Tasty Pixel
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: