Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yet another small JNI memory leak #10238

Merged
merged 1 commit into from
Feb 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions java/src/main/java/ai/rapids/cudf/ColumnVector.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ private static OffHeapState makeOffHeap(DType type, long rows, Optional<Long> nu
long viewHandle = initViewHandle(
type, (int)rows, nullCount.orElse(UNKNOWN_NULL_COUNT).intValue(),
dataBuffer, validityBuffer, offsetBuffer, null);
return new OffHeapState(type, (int) rows, dataBuffer, validityBuffer,
offsetBuffer, null, viewHandle);
return new OffHeapState(dataBuffer, validityBuffer, offsetBuffer, null, viewHandle);
}

/**
Expand Down Expand Up @@ -108,8 +107,7 @@ private static OffHeapState makeOffHeap(DType type, long rows, Optional<Long> nu
long viewHandle = initViewHandle(type, (int)rows, nullCount.orElse(UNKNOWN_NULL_COUNT).intValue(),
dataBuffer, validityBuffer,
offsetBuffer, childHandles);
return new OffHeapState(type, (int) rows, dataBuffer, validityBuffer, offsetBuffer,
toClose, viewHandle);
return new OffHeapState(dataBuffer, validityBuffer, offsetBuffer, toClose, viewHandle);
}

/**
Expand Down Expand Up @@ -968,12 +966,12 @@ public OffHeapState(long columnHandle) {
}

/**
* Create a cudf::column_view from device side data.
* Create from existing cudf::column_view and buffers.
*/
public OffHeapState(DType type, int rows,
DeviceMemoryBuffer data, DeviceMemoryBuffer valid, DeviceMemoryBuffer offsets,
public OffHeapState(DeviceMemoryBuffer data, DeviceMemoryBuffer valid, DeviceMemoryBuffer offsets,
List<DeviceMemoryBuffer> buffers,
long viewHandle) {
assert(viewHandle != 0);
if (data != null) {
this.toClose.add(data);
}
Expand All @@ -986,15 +984,11 @@ public OffHeapState(DType type, int rows,
if (buffers != null) {
toClose.addAll(buffers);
}
if (rows == 0 && !type.isNestedType()) {
this.columnHandle = makeEmptyCudfColumn(type.typeId.getNativeId(), type.getScale());
} else {
this.viewHandle = viewHandle;
}
this.viewHandle = viewHandle;
}

/**
* Create a cudf::column_view from contiguous device side data.
* Create from existing cudf::column_view and contiguous buffer.
*/
public OffHeapState(long viewHandle, DeviceMemoryBuffer contiguousBuffer) {
assert viewHandle != 0;
Expand Down