1.     204 if (inputEventObj) {
  2.     208     env->CallVoidMethod(mReceiverObjGlobal,
  3.     209          gInputEventReceiverClassInfo.dispatchInputEvent, seq, inputEventObj);
  4.     210     if (env->ExceptionCheck()) {
  5.     211         ALOGE("Exception dispatching input event.");
  6.     212         skipCallbacks = true;
  7.     213     }
  8.     214         env->DeleteLocalRef(inputEventObj);
  9.     215 } else {
  10.     216      ALOGW("channel '%s' ~ Failed to obtain event object.", getInputChannelName());
  11.     217     skipCallbacks = true;
  12.     218 }
The 4.1.2 source hasn't Line 214 . Lack of line 214 lead to java object inputEventObj leak. Android system print error like:

  1. dalvikvm: JNI ERROR (app bug): local reference table overflow (max=512)
  2. 09-25 11:56:11.939 712 729 W dalvikvm: JNI local reference table (0x5c3a3500) dump:
  3. 09-25 11:56:11.939 712 729 W dalvikvm: Last 10 entries (of 512):
  4. 09-25 11:56:11.939 712 729 W dalvikvm: 511: 0x42677b00 android.view.MotionEvent
  5. 09-25 11:56:11.939 712 729 W dalvikvm: 510: 0x42677b00 android.view.MotionEvent
  6. 09-25 11:56:11.939 712 729 W dalvikvm: 509: 0x42677b00 android.view.MotionEvent
  7. 09-25 11:56:11.939 712 729 W dalvikvm: 508: 0x42677b00 android.view.MotionEvent
  8. 09-25 11:56:11.939 712 729 W dalvikvm: 507: 0x42677b00 android.view.MotionEvent
  9. 09-25 11:56:11.939 712 729 W dalvikvm: 506: 0x42677b00 android.view.MotionEvent
  10. 09-25 11:56:11.939 712 729 W dalvikvm: 505: 0x42677b00 android.view.MotionEvent
  11. 09-25 11:56:11.939 712 729 W dalvikvm: 504: 0x42677b00 android.view.MotionEvent
  12. 09-25 11:56:11.939 712 729 W dalvikvm: 503: 0x42677b00 android.view.MotionEvent
  13. 09-25 11:56:11.939 712 729 W dalvikvm: 502: 0x42677b00 android.view.MotionEvent
  14. 09-25 11:56:11.939 712 729 W dalvikvm: Summary:
  15. 09-25 11:56:11.939 712 729 W dalvikvm: 1 of java.lang.Class
  16. 09-25 11:56:11.939 712 729 W dalvikvm: 511 of android.view.MotionEvent (1 unique instances)
  17. 09-25 11:56:11.939 712 729 E dalvikvm: Failed adding to JNI local ref table (has 512 entries)

09-18 21:58