Skip to content

Commit

Permalink
Add in new java API for raw host memory allocation (#17197)
Browse files Browse the repository at this point in the history
This is the first patch in a series of patches that should make it so that all java host memory allocations go through the DefaultHostMemoryAllocator unless another allocator is explicitly provided. 

This is to make it simpler to track/control host memory usage.

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

Approvers:
  - Jason Lowe (https://github.com/jlowe)
  - Alessandro Bellina (https://github.com/abellina)

URL: #17197
  • Loading branch information
revans2 authored Oct 29, 2024
1 parent ddfb284 commit 63b773e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion java/src/main/java/ai/rapids/cudf/HostMemoryBuffer.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (c) 2019-2020, NVIDIA CORPORATION.
* Copyright (c) 2019-2024, 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 @@ -155,6 +155,16 @@ public static HostMemoryBuffer allocate(long bytes) {
return allocate(bytes, defaultPreferPinned);
}

/**
* Allocate host memory bypassing the default allocator. This is intended to only be used by other allocators.
* Pinned memory will not be used for these allocations.
* @param bytes size in bytes to allocate
* @return the newly created buffer
*/
public static HostMemoryBuffer allocateRaw(long bytes) {
return new HostMemoryBuffer(UnsafeMemoryAccessor.allocate(bytes), bytes);
}

/**
* Create a host buffer that is memory-mapped to a file.
* @param path path to the file to map into host memory
Expand Down

0 comments on commit 63b773e

Please sign in to comment.