From 812aca35a050faacca1fde75703ebde7d976e542 Mon Sep 17 00:00:00 2001 From: "Robert (Bobby) Evans" Date: Mon, 7 Feb 2022 14:49:01 -0600 Subject: [PATCH] Yet another small JNI memory leak --- .../java/ai/rapids/cudf/ColumnVector.java | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/java/src/main/java/ai/rapids/cudf/ColumnVector.java b/java/src/main/java/ai/rapids/cudf/ColumnVector.java index cb3234bf706..11b654ccec6 100644 --- a/java/src/main/java/ai/rapids/cudf/ColumnVector.java +++ b/java/src/main/java/ai/rapids/cudf/ColumnVector.java @@ -68,8 +68,7 @@ private static OffHeapState makeOffHeap(DType type, long rows, Optional 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); } /** @@ -108,8 +107,7 @@ private static OffHeapState makeOffHeap(DType type, long rows, Optional 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); } /** @@ -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 buffers, long viewHandle) { + assert(viewHandle != 0); if (data != null) { this.toClose.add(data); } @@ -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;