HappenLee commented on code in PR #56181:
URL: https://github.com/apache/doris/pull/56181#discussion_r2362654608
##########
be/src/util/jni_native_method.cpp:
##########
@@ -39,4 +33,81 @@ void JavaNativeMethods::memoryFree(JNIEnv* env, jclass
clazz, jlong address) {
free(reinterpret_cast<void*>(address));
}
+jlongArray JavaNativeMethods::memoryMallocBatch(JNIEnv* env, jclass clazz,
jintArray sizes) {
+ if (sizes == nullptr) {
+ return env->NewLongArray(0);
+ }
+ jsize n = env->GetArrayLength(sizes);
+ if (n <= 0) {
+ return env->NewLongArray(0);
+ }
+
+ jint* elems = env->GetIntArrayElements(sizes, nullptr);
+ if (elems == nullptr) {
+ return nullptr;
+ }
+
+ jlongArray result = env->NewLongArray(n);
+ if (result == nullptr) {
+ env->ReleaseIntArrayElements(sizes, elems, JNI_ABORT);
Review Comment:
the fun should be defer call
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]