title: DeleteGlobalRef crash on ICS
body: <p>I use NDK to allocate large buffer for Java:</p>
  
  <pre><code>allocNativeBuffer(JNIEnv* env, jobject cls, jlong size) {
      void* buffer = malloc(size);
      jobject directBuffer = env-&gt;NewDirectByteBuffer(buffer, size);
      jobject globalRef = env-&gt;NewGlobalRef(directBuffer);
      return globalRef;
  }
  </code></pre>
  
  <p>After using this buffer I deallocate it:</p>
  
  <pre><code>freeNativeBuffer(JNIEnv* env, jobject cls, jobject globalRef) {
      void *buffer = env-&gt;GetDirectBufferAddress(globalRef);
      env-&gt;DeleteGlobalRef(globalRef);
      free(buffer);
  }
  </code></pre>
  
  <p>On Android 2.2 it works fine, but on Android 4.0.3 application crashes during DeleteGlobalRef call. What am I doing wrong?</p>