On Jul 29, 9:42 am, RM <[email protected]> wrote: > 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
For arrays, yes. Fields in objects are always 32 or 64 bits. > 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. Catch the OOM and call the API we added in 1.5 that saves an HPROF dump. Examine the heap dump to see where your memory went. Instructions are in dalvik/docs/heap-profiling.html: http://android.git.kernel.org/?p=platform/dalvik.git;a=blob_plain;f=docs/heap-profiling.html;hb=HEAD In particular, make sure there isn't something keeping your large arrays around after you believe you're no longer referencing them. While your application runs, it may be useful to keep an eye on the GC stats being written to the event log. dalvik/tools/gclog.py can help: http://bigflake.com/gclog.py.txt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

