Skip to content

Commit

Permalink
Yet another small JNI memory leak (#10238)
Browse files Browse the repository at this point in the history
Hopefully this is the last one, and this one only happens when we have an empty column vector (no rows).  So much less common. I will be running more tests to check/verify a lot of this.

Authors:
  - Robert (Bobby) Evans (https://github.com/revans2)

Approvers:
  - Jason Lowe (https://github.com/jlowe)
  - Kuhu Shukla (https://github.com/kuhushukla)

URL: #10238
  • Loading branch information
revans2 authored Feb 8, 2022
1 parent acb6aed commit 8af4e84
Showing 1 changed file with 7 additions and 13 deletions.
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

0 comments on commit 8af4e84

Please sign in to comment.