Skip to content

Commit

Permalink
Make DefaultHostMemoryAllocator settable (#14523)
Browse files Browse the repository at this point in the history
Authors:
  - Gera Shegalov (https://github.com/gerashegalov)

Approvers:
  - Robert (Bobby) Evans (https://github.com/revans2)
  - Jim Brennan (https://github.com/jbrennan333)

URL: #14523
  • Loading branch information
gerashegalov authored Nov 29, 2023
1 parent 8da6204 commit e696941
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions java/src/main/java/ai/rapids/cudf/DefaultHostMemoryAllocator.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,23 @@
package ai.rapids.cudf;

public class DefaultHostMemoryAllocator implements HostMemoryAllocator {
private static final HostMemoryAllocator INSTANCE = new DefaultHostMemoryAllocator();
private static volatile HostMemoryAllocator instance = new DefaultHostMemoryAllocator();

/**
* Retrieve current host memory allocator used by default if not passed directly to API
*
* @return current default HostMemoryAllocator implementation
*/
public static HostMemoryAllocator get() {
return INSTANCE;
return instance;
}

/**
* Sets a new default host memory allocator implementation by default.
* @param hostMemoryAllocator
*/
public static void set(HostMemoryAllocator hostMemoryAllocator) {
instance = hostMemoryAllocator;
}

@Override
Expand Down

0 comments on commit e696941

Please sign in to comment.