Ok, first I'm a longtime programmer, but a bit new to the world of Java (so my apologies in advance). I've done a bit of searching for answers or similar questions, but haven't found exactly what I'm looking for.
In my app, I'm allocating large arrays and experiencing some crashes, so a few questions on memory management: 1. Is memory saved in the Dalvik VM by using a short or byte vs. an integer? I've read some conflicting things on how this works. i.e. -- is the memory occupation as follows: Byte = 8bits Short = 16bits Int = 32bits 2. Garbage collection strategies. Specifically, I'm allocating a couple of large integer arrays in my main activity class. My program runs fine once. When I press the HOME button, however, and then re- launch the application it crashes when (re)allocating the arrays. As a way around this, I've declared the large int arrays as "static". This seems to prevent them from being re-allocated when the app goes from background to foreground. Not sure if this is the best strategy (?) However, getting past the int[] array HOME button crash, I get a crash my second run through during some Bitmap activities. I am doing a bitmap.recycle() after they are used...but, should large bitmaps be declared as static also? How are people working with large arrays and bitmaps that may push the limits of the VM heap on a single run through the application? In my experience, pressing the HOME button does not cause garbage collection of the arrays or bitmaps....yet relaunching the app attempts to reallocate them both. So, what's the best approach to dealing with things when you're nearly at the memory limit -- to allow the app to gracefully go from foreground/background? [It would be really great if Google could write an app note on this] Thanks, RM --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

