OutOfMemoryError
See original GitHub issueHi, thanks for your awesome library.
I got a crash report of an OutOfMemoryError that was caused by Konfetti.
Device: Samsung Galaxy S7 Android version: 7.0 Trace:
Fatal Exception: java.lang.OutOfMemoryError: Failed to allocate a 4861960 byte allocation with 2445416 free bytes and 2MB until OOM
at java.util.Arrays.copyOf(Arrays.java:3231)
at java.util.Arrays.copyOf(Arrays.java:3204)
at java.util.ArrayList.grow(ArrayList.java:249)
at java.util.ArrayList.ensureExplicitCapacity(ArrayList.java:223)
at java.util.ArrayList.ensureCapacityInternal(ArrayList.java:215)
at java.util.ArrayList.add(ArrayList.java:441)
at nl.dionsegijn.konfetti.emitters.RenderSystem.addConfetti(RenderSystem.kt:1034)
at nl.dionsegijn.konfetti.emitters.RenderSystem$1.invoke(RenderSystem.kt:1030)
at nl.dionsegijn.konfetti.emitters.StreamEmitter.createParticle(StreamEmitter.kt:2057)
at nl.dionsegijn.konfetti.KonfettiView.nl.dionsegijn.konfetti.emitters.RenderSystem.render(KonfettiView.kt:2046)
at android.view.View.draw(View.java:18319)
at android.view.View.updateDisplayListIfDirty(View.java:17297)
at android.view.View.draw(View.java:18081)
at android.view.ViewGroup.drawChild(ViewGroup.java:3966)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752)
at android.view.View.updateDisplayListIfDirty(View.java:17292)
at android.view.View.draw(View.java:18081)
at android.view.ViewGroup.drawChild(ViewGroup.java:3966)
at android.support.design.widget.CoordinatorLayout.drawChild(CoordinatorLayout.java:1254)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752)
at android.view.View.updateDisplayListIfDirty(View.java:17292)
at android.view.View.draw(View.java:18081)
at android.view.ViewGroup.drawChild(ViewGroup.java:3966)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752)
at android.view.View.updateDisplayListIfDirty(View.java:17292)
at android.view.View.draw(View.java:18081)
at android.view.ViewGroup.drawChild(ViewGroup.java:3966)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752)
at android.view.View.updateDisplayListIfDirty(View.java:17292)
at android.view.View.draw(View.java:18081)
at android.view.ViewGroup.drawChild(ViewGroup.java:3966)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752)
at android.view.View.updateDisplayListIfDirty(View.java:17292)
at android.view.View.draw(View.java:18081)
at android.view.ViewGroup.drawChild(ViewGroup.java:3966)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752)
at android.view.View.updateDisplayListIfDirty(View.java:17292)
at android.view.View.draw(View.java:18081)
at android.view.ViewGroup.drawChild(ViewGroup.java:3966)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752)
at android.view.View.draw(View.java:18322)
at com.android.internal.policy.DecorView.draw(DecorView.java:854)
at android.view.View.updateDisplayListIfDirty(View.java:17297)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:666)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:672)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:780)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:3112)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2908)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2502)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1509)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7051)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:927)
at android.view.Choreographer.doCallbacks(Choreographer.java:702)
at android.view.Choreographer.doFrame(Choreographer.java:638)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:913)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6692)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
And my setup was:
binding.konfetti.build()
.addColors(Color.rgb(239, 115, 47), Color.rgb(161, 44, 46), Color.rgb(39, 71, 134), Color.WHITE)
.setSpeed(1f, 3f)
.setFadeOutEnabled(true)
.setTimeToLive(3000L)
.addShapes(Shape.RECT, Shape.CIRCLE)
.addSizes(new Size(12, 5))
.setDirection(0.0, 180.0)
.setPosition(0, (float) binding.mainContent.getWidth(), -100F, -100F)
.stream(70, 3000L);
I just got one crash report, so I guess is some edge case.
Cheers!
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
OutOfMemoryError (Java Platform SE 7 ) - Oracle Help Center
Thrown when the Java Virtual Machine cannot allocate an object because it is out of memory, and no more memory could be made...
Read more >Understanding OutOfMemoryError Exception in Java
OutOfMemoryError usually means that you're doing something wrong, either holding onto objects too long or trying to process too much data at a ......
Read more >OutOfMemoryError - Android Developers
OutOfMemoryError objects may be constructed by the virtual machine as if writable. ... Constructs an OutOfMemoryError with no detail message.
Read more >OutOfMemoryError exceptions - IBM
The JVM throws a java.lang.OutOfMemoryError exception when the heap is full and the JVM cannot find space for object creation. Heap usage is...
Read more >Java OutOfMemoryError Exceptions: Causes & Fixes [Tutorial]
A java.lang.OutOfMemoryError means that something is wrong in the application – to be precise there was an issue with a part of application ......
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 FreeTop 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
Top GitHub Comments
It’s the only crash report that I got from that user and the only crash report where Konfetti was involved (Konfetti was running just one day). When the crash happened, the device had 24% of the RAM free. The screen where I was showing the confetti was pretty simple, I cannot think of anything that could be clogging up the memory there.
Closing this for now since I haven’t had more reports. Please open a new issue when the same problem reoccurs.