A problem with the Android NDK is that is does not clear static data each time your app is started. this is because once the shared library is loaded in memory, it does not kick it out unless it’s short of memory.
unfortunately, this is bad if you app quits or is made to quit or is quitted for you somehow.
There are also problems with static data that might go “stale” if left too long. For example `Time::getCurrentTime’ uses a static for wraparound. this will go stale after around 50 days.
Another problem is that `getCurrentTime’ returns yesterday if i’ve run the app yesterday. quit it and later run it today. in fact, it never advances time.
Unfortunately, everyone out there seems to think you should either not use statics, should never quit your app or should write code to manually reset them.
however, i’d like to find a proper way to clear statics.
here’s what i have, but it’s not nice, for some reason this works,
juce_android_windowing.cpp
[quote]JUCE_JNI_CALLBACK (JUCE_ANDROID_ACTIVITY_CLASSNAME, quitApp, void, (JNIEnv* env, jobject activity))
{
JUCEApplicationBase::appWillTerminateByForce();
android.shutdown (env);
// XXX
// This is HACK to reset static data.
exit(0);
}
[/quote]
– hugh.