Android new Intent memory leak / out of memory -
i've got app 2 activities. first 1 launches on startup , button launches second activity using intent.
intent intent = new intent(mainactivity.this, com.example.project.someactivity.class); startactivityforresult(intent, 0);
in second activity have camera , memory allocation.
when press 'close' button in second activity, call close on camera , finish on activity.
m_camera.close(cameraenum.front.getcameraid()); this.finish(); system.gc();
when close activity first time , call first activity good, second time - when open in third time - out of memory error on line:
m_data = new byte[4*width*height];
the error is:
05-19 14:22:51.440: e/dalvikvm-heap(31838): out of memory on 1228816-byte allocation. ... 05-19 14:42:42.174: e/androidruntime(7345): java.lang.outofmemoryerror
i can find out why should happen.
any ideas?
thanks!
well, found problem - memory leak due holding reference 'context' object. after releasing - app doesn't crash anymore.
Comments
Post a Comment