> On Oct 19, 2016, at 8:41 PM, Alex Zavatone <z...@mac.com> wrote: > > In that case we would find out really quickly, because this is one of the > classes that starts up as soon as the app makes several server calls. When > our error happens that appears like a dealloc, the app has been running and > using this class for a while and is sitting around on iOS while it is in the > background. > > Yet we are seeing log output indicating the init method getting executed > twice.
Verify that you are seeing two init logs from one process rather than one init log each from two processes. (Adding the PID to the log should resolve that, if you don't have it already.) Verify that your singleton enforcement is thread-safe. Thread-unsafe singleton enforcement can create a second singleton if there is a race. Log the stack trace of each init call. Perhaps one caller is bypassing your singleton enforcement somehow. (For example, you wrote singleton enforcement in +alloc but some call sites are using +allocWithZone:.) Log the address of the object being returned by init. Perhaps there is only one object but init is being called a second time on it. Log or crash in dealloc, if your singleton enforcement might allow the object to be deallocated and then a new one to be created. -- Greg Parker gpar...@apple.com <mailto:gpar...@apple.com> Runtime Wrangler _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com