Skip to content

Commit 4163b43

Browse files
author
S O'Donnell
committed
HADOOP-17209. Erasure Coding: Native library memory leak. Contributed by Sean Chow
(cherry picked from commit 17cd8a1)
1 parent 4ab1469 commit 4163b43

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/erasurecode/jni_common.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ void getInputs(JNIEnv *env, jobjectArray inputs, jintArray inputOffsets,
9292
destInputs[i] = NULL;
9393
}
9494
}
95+
(*env)->ReleaseIntArrayElements(env, inputOffsets, tmpInputOffsets, 0);
9596
}
9697

9798
void getOutputs(JNIEnv *env, jobjectArray outputs, jintArray outputOffsets,
@@ -112,4 +113,5 @@ void getOutputs(JNIEnv *env, jobjectArray outputs, jintArray outputOffsets,
112113
byteBuffer));
113114
destOutputs[i] += tmpOutputOffsets[i];
114115
}
115-
}
116+
(*env)->ReleaseIntArrayElements(env, outputOffsets, tmpOutputOffsets, 0);
117+
}

hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/erasurecode/jni_rs_decoder.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ jintArray outputOffsets) {
6666

6767
decode(&rsDecoder->decoder, rsDecoder->inputs, tmpErasedIndexes,
6868
numErased, rsDecoder->outputs, chunkSize);
69+
(*env)->ReleaseIntArrayElements(env, erasedIndexes, tmpErasedIndexes, 0);
6970
}
7071

7172
JNIEXPORT void JNICALL

0 commit comments

Comments
 (0)