Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OOM errors and ANRs #365

Closed
archie94 opened this issue Feb 7, 2019 · 4 comments
Closed

OOM errors and ANRs #365

archie94 opened this issue Feb 7, 2019 · 4 comments

Comments

@archie94
Copy link
Collaborator

archie94 commented Feb 7, 2019

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

@n8fr8
Copy link
Member

n8fr8 commented Feb 7, 2019

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

@n8fr8
Copy link
Member

n8fr8 commented Feb 7, 2019

How much RAM does your device have?

@n8fr8 n8fr8 added this to the Current Sprint milestone Feb 7, 2019
@n8fr8
Copy link
Member

n8fr8 commented Feb 7, 2019

@n8fr8
Copy link
Member

n8fr8 commented Feb 7, 2019

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.

n8fr8 added a commit that referenced this issue Feb 8, 2019
- we are creating too many in memory bitmaps just for fancy UI that isn't that usable
- this now displays a simple "motion detected" string instead of the change detection overlay
n8fr8 added a commit that referenced this issue Feb 10, 2019
for #365 reduce camera resolution and remove one unneeded bitmap
@n8fr8 n8fr8 closed this as completed Feb 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants