platform/frameworks/base/core/jni/android/graphics/YuvToJpegEncoder.cpp:213
...
static jboolean YuvImage_compressToJpeg(JNIEnv* env, jobject, jbyteArray
inYuv,
int format, int width, int height, jintArray offsets,
jintArray strides, int jpegQuality, jobject jstream,
jbyteArray jstorage) {
jbyte* yuv = env->GetByteArrayElements(inYuv, NULL); *<=
alloc here*
SkWStream* strm = CreateJavaOutputStreamAdaptor(env, jstream,
jstorage);
jint* imgOffsets = env->GetIntArrayElements(offsets, NULL); *<=
alloc here*
jint* imgStrides = env->GetIntArrayElements(strides, NULL); *<=
alloc here*
YuvToJpegEncoder* encoder = YuvToJpegEncoder::create(format,
imgStrides);
if (encoder == NULL) {
* <= it is a leak here?*
return false;
}
encoder->encode(strm, yuv, width, height, imgOffsets, jpegQuality);
delete encoder;
env->ReleaseByteArrayElements(inYuv, yuv, 0);
env->ReleaseIntArrayElements(offsets, imgOffsets, 0);
env->ReleaseIntArrayElements(strides, imgStrides, 0);
return true;
}
platform/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp:212
...
if (peeker.fPatchIsValid) {
size_t ninePatchArraySize = peeker.fPatch->serializedSize();
ninePatchChunk = env->NewByteArray(ninePatchArraySize); *<=
alloc here*
if (NULL == ninePatchChunk) {
return nullObjectReturn("ninePatchChunk == null");
}
jbyte* array =
(jbyte*)env->GetPrimitiveArrayCritical(ninePatchChunk,
NULL);
if (NULL == array) {
* <= should we release ninePatchChunk
here*
return nullObjectReturn("primitive array == null");
}
peeker.fPatch->serialize(array);
env->ReleasePrimitiveArrayCritical(ninePatchChunk, array, 0);
}
GC will realese this objects or we should do this ?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en