Note also that some Java 5 idioms will allocate objects "for you" if you're not careful. For example, string concatenation like:
myString = "value of x is" + x; Will allocate a temporary StringBuilder object each time this statement is executed. Other cases are using for () to iterate over certain collections. On Thu, Apr 2, 2009 at 11:15 AM, David Turner <[email protected]> wrote: > Without any detail about what your core loop is doing, there is no way we > can answer that. > The general rule of thumb is "don't allocate" and you won't get a GC at > all. > > > On Thu, Apr 2, 2009 at 10:53 AM, [email protected] < > [email protected]> wrote: > >> >> So my app is performing ok, but could be running a lot better. >> >> LogCat shows me every 4 - 5 seconds, GC freed usually about 20,000 >> bytes each time, so clearly I am doing something wrong. >> >> I have gone through the reference material on GC / memory allocation >> at >> http://developer.android.com/guide/practices/design/performance.html >> >> I have also looked at Android source classes such as View which I know >> are designed for performance : >> >> http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/view/View.java;h=04447ca4719df5bf274ce4d04e1df7ef28f89a83;hb=HEAD >> >> I don't have any new constructors in my user control loop and I >> calculate any 'new' primitives using a final constructor beforehand >> like in the samples. >> >> What else do I need to check? >> >> >> > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

