Many times, such errors arise as a result of an “ideal storm” of circumstances (ie race conditions, infrequent tasks that are performed only at the “right” time, etc.), and often circumstances that you simply cannot foresee; if you knew how to reliably reproduce it, you probably also know how to fix it. The next thing you can hope for is to try to increase the statistical chances of reproducing it in an environment (debugger), where you could hope to understand what is happening.
See this post: iOS Development: how can I trigger low memory alerts on a device? . By simulating software memory warnings, you can (for example) use a repeating timer to trigger a 1 / second memory warning (much faster than this, and you may run into other problems that will cause you to chase your tail more than solve your original problem) , eliminating the need to do this manually.
Before actually running the test, you can also set breakpoints in the following places:
Symbol Module
Also, set breakpoints in all Objective-C exceptions. Setting a breakpoint allows you to check the contents of the memory before the exception is actually thrown by the runtime, which will give you a much better chance of understanding the problem when this happens. When (and if) you commit a crash, check pid , pid.UTF8String and sql_stmt , as they look like the most likely culprits.
Launch the application and turn on the timer. This will not necessarily or directly lead to the failure you are looking for, but most likely it will become more likely over time without having to hold hands; you can turn off the timer and wait (that is, do something more productive) until you see a collision.
fullofsquirrels
source share