Bug? Activity Memory Leak?

Discussion in 'Bugs & wishlist' started by Jack Cole, Mar 9, 2015.

  1. Jack Cole

    Jack Cole Active Member Licensed User

    I am having trouble with memory leaks. I have one app with millions of installs. There are thousands of out of memory errors daily tracked on Google Analytics. Many of these, I was able to reduce. However, there are still significant problems.

    In investigating the issue, there is a loss of 2 to 3K of free memory when orientation changes or a new activity is loaded and then closed.

    I have attached a simple example. Switching orientation over and over eventually leads to a forced close with an out of memory error.

    The attached example needs the VBBitmap library.

    Is this an Android problem or something that could be improved in the generated java code?

    Best regards,
    Jack
     

    Attached Files:

  2. Erel

    Erel Administrator Staff Member Licensed User

    Your program doesn't leak memory on Nexus 5. However as you are loading a large image every time it will be more efficient to load it once when FirstTime is true and then save it in a process global variable.

    You can also try to disable the layout animations.
     
    Peter Simpson likes this.
  3. Jack Cole

    Jack Cole Active Member Licensed User

    Thanks Erel. It seems to be related to the layout animations. Disabling that seems to take care of the leak on my test devices. I do like the animation. Any ideas on how to be able to use those without it causing a problem?
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Which device are you using for testing?
     
  5. Jack Cole

    Jack Cole Active Member Licensed User

    Droid Razr HD with 4.4.2. It also occurs on Kindle Fire HD.

    Here is an example with the app example running on the Fire HD. In the log below, you see what happens when I change orientation.

    Here is what it does with the animation turned off on the layout. Does not have the leak.

     
  6. Erel

    Erel Administrator Staff Member Licensed User

    I will check it.
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    This issue is fixed for v5.00.
     
    ellpopeb4a likes this.
  8. Jack Cole

    Jack Cole Active Member Licensed User

    That's great Erel! I'm looking forward to using the layout animations again.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice