Shortcuts

Template Class SimpleAllocator

Class Documentation

template<AllocArch Arch, typename LockingPolicy = Spinlock>
class ripple::SimpleAllocator

Defines a simple allocator for either the cpu or the gpu.

Template Parameters
  • Arch: The architecture to allocate for.

  • LockingPolicy: The locking policy for the allocator.

Public Functions

template<AllocArch ArchType = Arch, std::enable_if_t<ArchType == AllocArch::cpu, int> = 0>
SimpleAllocator() noexcept

Constructor to set the device id for the allocator.

Parameters
  • dev_id: The id of the device to allocate for.

template<AllocArch ArchType = Arch, std::enable_if_t<ArchType == AllocArch::gpu, int> = 0>
SimpleAllocator(size_t dev_id) noexcept

Constructor to set the device id for the allocator.

Parameters
  • dev_id: The id of the device to allocate for.

auto reserve(size_t bytes) -> void

Reserves The given number of bytes for the allocator.

Parameters
  • bytes: The number of bytes to reserve.

auto alloc(size_t size, size_t alignment) -> void*

Allocates the given amount of memory.

Return

A pointer to the new memory.

Parameters
  • size: The number of bytes to allocate.

auto free(void *ptr) -> void

Frees the memory pointed to by the pointer.

This does nothing as of right now, this allocator can only reset.

Parameters
  • ptr: The pointer to free.

auto reset() noexcept -> void

Resets the allocator.

Docs

Access comprehensive developer documentation for Ripple

View Docs

Tutorials

Get tutorials to help with understand all features

View Tutorials

Examples

Find examples to help get started

View Examples