![]() |
GHOST
1.1.2
General, Hybrid, and Optimized Sparse Toolkit
|
#include "ghost/cu_temp_buffer_malloc.h"
#include "ghost/error.h"
#include "ghost/log.h"
#include "ghost/util.h"
#include <algorithm>
#include <iostream>
#include <mutex>
#include <thread>
#include <vector>
Classes | |
struct | SmallBuffer |
Functions | |
ghost_error | ghost_cu_temp_buffer_malloc (void **mem, size_t bytesize) |
Useful for allocating small temporary buffers. Keeps a list of previously allocated and freed buffers, and returns one if the size fits. Threadsafe. More... | |
ghost_error | ghost_cu_temp_buffer_free (void *mem) |
Frees memory allocated with ghost_cu_temp_buffer_malloc. Threadsafe. More... | |
Variables | |
vector< SmallBuffer > | buffers |
std::mutex | cu_temp_buffer_malloc_mutex |
unsigned int | peakBufferCount = 0 |
ghost_error ghost_cu_temp_buffer_free | ( | void * | mem | ) |
Frees memory allocated with ghost_cu_temp_buffer_malloc. Threadsafe.
mem | Which address to free |
ghost_error ghost_cu_temp_buffer_malloc | ( | void ** | mem, |
size_t | bytesize | ||
) |
Useful for allocating small temporary buffers. Keeps a list of previously allocated and freed buffers, and returns one if the size fits. Threadsafe.
mem | Where to store the memory. |
bytesize | The number of bytes to allocate. |
vector<SmallBuffer> buffers |
std::mutex cu_temp_buffer_malloc_mutex |
unsigned int peakBufferCount = 0 |