Life span of JNI C++ heap in an Android app
===

I'm in the process of re-architecting our Android app.  It is a complex app that consists of many Activities.  The main Activity loads a JNI native library.  This library allocates a number of structures on the C++ heap.

If the app is down in some subActivity and the main Activity gets stopped and unloaded due to low memory, what happens to the memory on the C++ heap?  Does this persist as long as the application process is running or can it somehow get deallocated when the Activity that loaded the library goes away?

I guess I have a similar question about a global C variable in the library.  Will it persist for the life of the whole process?

Thanks.