-
Notifications
You must be signed in to change notification settings - Fork 6
Troubleshooting
Having problems? See if we have a solution.
We support caching Jackson objects to reduce the amount of time required in "cold-starts," or the first API call to the server.
Serializing Jackson objects to the cache file, as well as deserialization the Jackson object from the cache file, can take a significant amount of memory on the stack. In fact, if we use the default Android stack size for the thread that is reading/writing the cache file, a stack overflow exception will be thrown and the app will crash.
We currently provide a work-around for this issue by increasing the stack size in the threads that are reading/writing to the cached file, using a [specific constructor for Threads](http://developer.android.com/reference/java/lang/Thread.html#Thread(java.lang.ThreadGroup, java.lang.Runnable, java.lang.String, long)) that allow us to increase the stack size. Stack size for XmlMapper, the Jackson object that parses XML, is larger than the ObjectMapper/ObjectReader Jackson objects used to parse JSON, because the size of the XmlMapper is much bigger. We also provide setters and getters to allow apps to set the stack sizes themselves.
A caveat with this workaround is that the stacksize parameter is implementation-dependent, so there is no guarantee that this will fix the issue on all Android devices. If stackoverflows happen on certain devices and changing the stack size parameter doesn't prevent the issue, then caching cannot be used on those devices.