Skip to content

OOM errors and ANRsΒ #365

Closed
Closed

Description

@archie94

Getting OOM errors on the current dev branch (272b341)

Logs:

java.lang.OutOfMemoryError: Failed to allocate a 8294412 byte allocation with 1663176 free bytes and 1624KB until OOM
 at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
 at android.graphics.Bitmap.nativeCreate(Native Method)
 at android.graphics.Bitmap.createBitmap(Bitmap.java:890)
 at android.graphics.Bitmap.createBitmap(Bitmap.java:867)
 at android.graphics.Bitmap.createBitmap(Bitmap.java:798)
 at org.havenapp.main.sensors.motion.MotionDetector.detect(MotionDetector.java:132)
 at org.havenapp.main.sensors.motion.CameraViewHolder.processNewFrame(CameraViewHolder.java:330)
 at org.havenapp.main.sensors.motion.CameraViewHolder.access$700(CameraViewHolder.java:57)
 at org.havenapp.main.sensors.motion.CameraViewHolder$2.lambda$process$0(CameraViewHolder.java:234)
 at org.havenapp.main.sensors.motion.-$$Lambda$CameraViewHolder$2$B8P48X5F17tkzOvmZzEKi2v1Qac.run(lambda)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
 at java.lang.Thread.run(Thread.java:760)
java.lang.OutOfMemoryError: Failed to allocate a 8294412 byte allocation with 2870720 free bytes and 2MB until OOM
 at org.havenapp.main.sensors.media.ImageCodec.lumaToGreyscale(ImageCodec.java:44)
 at org.havenapp.main.sensors.media.ImageCodec.lumaToBitmapGreyscale(ImageCodec.java:55)
 at org.havenapp.main.sensors.motion.MotionDetector.detect(MotionDetector.java:111)
 at org.havenapp.main.sensors.motion.CameraViewHolder.processNewFrame(CameraViewHolder.java:330)
 at org.havenapp.main.sensors.motion.CameraViewHolder.access$700(CameraViewHolder.java:57)
 at org.havenapp.main.sensors.motion.CameraViewHolder$2.lambda$process$0(CameraViewHolder.java:234)
 at org.havenapp.main.sensors.motion.-$$Lambda$CameraViewHolder$2$B8P48X5F17tkzOvmZzEKi2v1Qac.run(lambda)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
 at java.lang.Thread.run(Thread.java:760)

These are reproducible on my side when you reduce the motion detection sensitivity significantly. Furthermore on deactivating an ongoing Event session there are frame skips which are areas that needs optimizations.

2019-02-07 23:54:27.380 7795-7795/org.havenapp.main I/CameraFragment: SERVICE DISCONNECTED
2019-02-07 23:54:27.633 7795-7844/org.havenapp.main D/Camera: app passed NULL surface
2019-02-07 23:54:27.844 7795-8151/org.havenapp.main D/skia: onFlyCompress
2019-02-07 23:54:27.852 7795-7806/org.havenapp.main I/art: Background sticky concurrent mark sweep GC freed 22(26KB) AllocSpace objects, 2(56KB) LOS objects, 0% free, 86MB/86MB, paused 772us total 103.571ms
2019-02-07 23:54:31.781 7795-7844/org.havenapp.main D/Camera: app passed NULL surface
2019-02-07 23:54:31.792 7795-7795/org.havenapp.main I/Choreographer: Skipped 248 frames!  The application may be doing too much work on its main thread.
2019-02-07 23:54:33.778 7795-7800/org.havenapp.main I/art: Do full code cache collection, code=104KB, data=125KB
2019-02-07 23:54:33.779 7795-7800/org.havenapp.main I/art: After code cache collection, code=103KB, data=100KB

Device Info:
Redmi Note 4(mido)
MIUI Global 10.1
Android version 7.0

Activity

  1. n8fr8 commented on Feb 7, 2019

    @n8fr8
    Member

    This is the flip side of not using RenderScript to handle some of the bitmap conversion.... will dig in!

  2. n8fr8 commented on Feb 7, 2019

    @n8fr8
    Member

    How much RAM does your device have?

  3. added this to the Current Sprint milestone on Feb 7, 2019
  4. n8fr8 commented on Feb 7, 2019

    @n8fr8
    Member
  5. n8fr8 commented on Feb 7, 2019

    @n8fr8
    Member

    The issue is that your camera is very high res compared to my devices. This can be fixed by controlling resolution of the new CameraView.

  6. added 3 commits that reference this issue on Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions