Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7078605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:34:07+00:00 2026-05-28T06:34:07+00:00

I have an Activity that opens the Camera and starts a preview on a

  • 0

I have an Activity that opens the Camera and starts a preview on a SurfaceTexture. Everything works fine, but I’ve noticed that if I repeatedly leave the activity and return to it, after a handful of times, the phone freezes and then reboots.

I’ve narrowed the problem down to the call to startPreview. And I get two ominous log messages right before the issue happens:

01-19 10:20:52.038: E/IMGSRV(22777): :0: __map: Map device memory failed
01-19 10:20:52.038: W/GraphicBufferMapper(22777): registerBuffer(0x70b750) failed -14 (Bad address)

Has anyone seen this before? Is this an issue with the Galaxy Nexus hardware or Android 4.0? If so, are there any work arounds?

Note: My testing is on Android 4.0, with a Galaxy Nexus.

Edit – Solved:

Turns out it was a memory leak due to OpenGL. All the examples on the web I could find use the following code to clean up after OpenGL.

try { mEgl.eglDestroyContext(mEglDisplay, mEglContext); } catch (Throwable t) {}
try { mEgl.eglDestroySurface(mEglDisplay, mEglSurface); } catch (Throwable t) {}

This leaks the surface, and as a result after some number of tries, which varies per phone, will cause OpenGL to fail to initialize. For instance it would fail after 32 tries on the Nexus S, but only 8 tries on the LG Optimus.

After some trial and error I found that the following code fixed the issue:

mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);

Note: On the Galaxy Nexus instead of getting a nice OpenGL error which I could display to the user it just seemed to crash on startPreview. I assume this was memory related, but the above fixed cleared it up as well.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:34:08+00:00Added an answer on May 28, 2026 at 6:34 am

    The SDK docs for the android.hardware.Camera class say the following:

    Important: Call release() to release the camera for use by other
    applications. Applications should release the camera immediately in
    onPause() (and re-open() it in onResume()).

    Are you certain your activity releases the camera in onPause() and re-opens it in onResume()?

    If you post a code sample, we would be better able to troubleshoot your problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a very simple android activity that starts a timer when you
I have Activity A. It opens Activity B that is a dialog Activity with
Cant figure this out (am a noob) but I have a default activity that
I have recently built an application that shows you a camera preview on screen.
I have an activity (A) with a listview that opens a second activity (B)
let's have activity A and button in that activity, which opens activity A again.
I have a ListView that opens another activity when an item row is clicked
I have an activity that has a TabHost containing a set of TabSpecs each
I have an activity that contains several user editable items (an EditText field, RatingBar,
I have an activity that launches another activity with startActivityForResult method. I would like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.