question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Memory error for downloaded image even though enough memory is available

See original GitHub issue

TLDR: The error seems to be that the Mixpanel SDK uses Runtime.getRuntime().freeMemory() for checking if enough memory is available. This is wrong as the heap may expand dynamically, the documentation (for Android M) states:

    /**
     * Returns the number of bytes currently available on the heap without expanding the heap. See
     * {@link #totalMemory} for the heap's current size. When these bytes are exhausted, the heap
     * may expand. See {@link #maxMemory} for that limit.
     */

Exception was:

V/MixpanelAPI.DChecker: Can't load image https://URLREMOVED/image.jpg for a notification
                                                                     com.mixpanel.android.util.ImageStore$CantGetImageException: Do not have enough memory for the image
                                                                         at com.mixpanel.android.util.ImageStore.getImage(ImageStore.java:102)
                                                                         at com.mixpanel.android.mpmetrics.DecideChecker.getNotificationImage(DecideChecker.java:256)
                                                                         at com.mixpanel.android.mpmetrics.DecideChecker.runDecideCheck(DecideChecker.java:99)
                                                                         at com.mixpanel.android.mpmetrics.DecideChecker.runDecideChecks(DecideChecker.java:68)
                                                                         at com.mixpanel.android.mpmetrics.AnalyticsMessages$Worker$AnalyticsMessageHandler.handleMessage(AnalyticsMessages.java:263)
                                                                         at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                         at android.os.Looper.loop(Looper.java:148)
                                                                         at android.os.HandlerThread.run(HandlerThread.java:61)

The result is that currently no notifications can be shown because the SDK thinks the images are too large - which they are not.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
pateditcommented, Apr 29, 2016

Those startup parameters specify the initial and maximum heap size. totalMemory and maxMemory correlate with those - hence my comment 😃 Dynamically changing the heap size or setting different values for Xms and Xmx are valid scenarios for this fix. Will keep an eye if someone else is having issues with notifications and will make a release if needed. Thanks @mreichelt !

0reactions
mreicheltcommented, May 12, 2016

Sure thing 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Fix] Error “Windows Photo Viewer can't display this picture”
Windows Photo Viewer can't display this picture because there might not be enough memory available on your computer.
Read more >
Windows photo viewer can't run because not enough memory?
The EASIEST solution is to open up the image in a hex editor such as Notepad++, navigate to 'ICC_PROFILE'. You will find this...
Read more >
Photo Viewer Not Enough Memory? Here's How To Fix It
On the Command Prompt window, type in the command: sfc /scannow and hit the Enter key.
Read more >
Windows photo viewer can't display this picture because there
Windows photo viewer can't display this picture because there might not be enough memory available on your computer error.
Read more >
Fix: Windows Photo Viewer Can't Display This Picture Not ...
Your computer will display the message “Not Enough Memory to Complete This Operation” if the necessary memory is not available. Furthermore, a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found