-
Notifications
You must be signed in to change notification settings - Fork 0
Kokkos::kokkos_realloc
Defined in header <Kokkos_Core.hpp>
template <class MemorySpace = typename Kokkos::DefaultExecutionSpace::memory_space>
void* kokkos_realloc(void* ptr, size_t new_size);
Reallocates the given area of memory. It must be previously allocated by Kokkos::kokkos_malloc()
or Kokkos::kokkos_realloc()
on the same memory space MemorySpace
and not yet freed with Kokkos::kokkos_free()
, otherwise, the results are undefined.
ptr
: The pointer to the memory area to be reallocated.
new_size
: The new size in bytes.
-
MemorySpace
: Controls the storage location. If omitted the memory space of the default execution space is used (i.e.Kokkos::DefaultExecutionSpace::memory_space
).
On success, returns a pointer to the beginning of the newly allocated memory. To avoid a memory leak, the returned pointer must be deallocated with Kokkos::kokkos_free()
, the original pointer ptr
is invalidated and any access to it is undefined behavior (even if reallocation was in-place).
On failure, returns a null pointer. The original pointer ptr remains valid and may need to be deallocated with Kokkos::kokkos_free()
.
On failure, throws Kokkos::Experimental::RawMemoryAllocationFailure
.
Home:
- Introduction
- Machine Model
- Programming Model
- Compiling
- Initialization
- View
- Parallel Dispatch
- Hierarchical Parallelism
- Custom Reductions
- Atomic Operations
- Subviews
- Interoperability
- Kokkos and Virtual Functions
- Initialization and Finalization
- View
- Data Parallelism
- Execution Policies
- Spaces
- Task Parallelism
- Utilities
- STL Compatibility
- Numerics
- Detection Idiom