Skip to content

Commit

Permalink
Fix a leak in a test and clarify some test names (#12781)
Browse files Browse the repository at this point in the history
Fix a small leak of host memory in a java unit test. Also updates some tests that verify that a double free is safe, but don't make it clear from the logs that the double free is expected to be there. This is so we don't have to spend too much time debugging if this double free is expected or not.

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

Approvers:
  - Kuhu Shukla (https://github.com/kuhushukla)
  - Jim Brennan (https://github.com/jbrennan333)
  - Jason Lowe (https://github.com/jlowe)
  - Raza Jafri (https://github.com/razajafri)
  - Gera Shegalov (https://github.com/gerashegalov)

URL: #12781
  • Loading branch information
revans2 authored Feb 17, 2023
1 parent b1aa5d2 commit ec8704a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions java/src/test/java/ai/rapids/cudf/ColumnVectorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1045,8 +1045,8 @@ void decimal128Cv() {
BigInteger bigInteger2 = new BigInteger("14");
BigInteger bigInteger3 = new BigInteger("152345742357340573405745");
final BigInteger[] bigInts = new BigInteger[] {bigInteger1, bigInteger2, bigInteger3};
try (ColumnVector v = ColumnVector.decimalFromBigInt(-dec32Scale1, bigInts)) {
HostColumnVector hostColumnVector = v.copyToHost();
try (ColumnVector v = ColumnVector.decimalFromBigInt(-dec32Scale1, bigInts);
HostColumnVector hostColumnVector = v.copyToHost()) {
assertEquals(bigInteger1, hostColumnVector.getBigDecimal(0).unscaledValue());
assertEquals(bigInteger2, hostColumnVector.getBigDecimal(1).unscaledValue());
assertEquals(bigInteger3, hostColumnVector.getBigDecimal(2).unscaledValue());
Expand Down
4 changes: 2 additions & 2 deletions java/src/test/java/ai/rapids/cudf/ScalarTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -41,7 +41,7 @@ public void testDoubleClose() {
}

@Test
public void testIncRef() {
public void testIncRefAndDoubleFree() {
Scalar s = Scalar.fromNull(DType.INT32);
try (Scalar ignored1 = s) {
try (Scalar ignored2 = s.incRefCount()) {
Expand Down
2 changes: 1 addition & 1 deletion java/src/test/java/ai/rapids/cudf/TableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ void testOrderByWithNullsAndStrings() {
}

@Test
void testTableCreationIncreasesRefCount() {
void testTableCreationIncreasesRefCountWithDoubleFree() {
//tests the Table increases the refcount on column vectors
assertThrows(IllegalStateException.class, () -> {
try (ColumnVector v1 = ColumnVector.build(DType.INT32, 5, Range.appendInts(5));
Expand Down

0 comments on commit ec8704a

Please sign in to comment.