Memory error for downloaded image even though enough memory is available
See original GitHub issueTLDR: 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:
- Created 7 years ago
- Comments:7 (7 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Those startup parameters specify the initial and maximum heap size.
totalMemory
andmaxMemory
correlate with those - hence my comment 😃 Dynamically changing the heap size or setting different values forXms
andXmx
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 !Sure thing 😃