Objective-C programs often treat dispatch_once blocks similarly to global
variables, since they are only executed once over the course of the process.
They are often used to initialize singletons and other process state.
For an example of a simple test case which reveals this behavior in darwin system
libraries:
// clang -fsanitize=leak -framework Foundation test.m #import <Foundation/Foundation.h> int main() { @autoreleasepool { id defaults = [NSUserDefaults standardUserDefaults]; }; return 0; }
This patch treats dispatch_once allocations as global variables, ignoring
them if use_globals is enabled.