thrust
Functions
Deallocation Functions
Memory Management Functions

Functions

template<typename T >
void thrust::device_delete (thrust::device_ptr< T > ptr, const size_t n=1)
void thrust::device_free (thrust::device_ptr< void > ptr)

Function Documentation

template<typename T >
void thrust::device_delete ( thrust::device_ptr< T >  ptr,
const size_t  n = 1 
) [inline]

device_delete deletes a device_ptr allocated with device_new.

Parameters:
ptrThe device_ptr to delete, assumed to have been allocated with device_new.
nThe number of objects to destroy at ptr. Defaults to 1 similar to device_new.
See also:
device_ptr
device_new

Referenced by thrust::device_new_allocator< T >::deallocate().

void thrust::device_free ( thrust::device_ptr< void >  ptr) [inline]

device_free deallocates memory allocated by the function device_malloc.

Parameters:
ptrA device_ptr pointing to memory to be deallocated.

The following code snippet demonstrates how to use device_free to deallocate memory allocated by device_malloc.

  #include <thrust/device_malloc.h>
  #include <thrust/device_free.h>
  ...
  // allocate some integers with device_malloc
  const int N = 100;
  thrust::device_ptr<int> int_array = thrust::device_malloc<int>(N);

  // manipulate integers
  ...

  // deallocate with device_free
  thrust::device_free(int_array);
See also:
device_ptr
device_malloc

Referenced by thrust::device_malloc_allocator< T >::deallocate().