* \brief Frees memory previously allocated with allocateDevice(size_t). * Passing a NULL-pointer should be a no-op. * \param memory the memory to be freed */
| 309 | * \param memory the memory to be freed |
| 310 | */ |
| 311 | void freeDevice(void* memory) |
| 312 | { |
| 313 | CUMAT_PROFILING_INC(DeviceMemFree); |
| 314 | #if CUMAT_CONTEXT_DEBUG_MEMORY==1 |
| 315 | if (memory != nullptr) { |
| 316 | allocationsDevice_--; |
| 317 | CUMAT_ASSERT(allocationsDevice_ >= 0 && "You freed more pointers than were allocated"); |
| 318 | } |
| 319 | #endif |
| 320 | #if CUMAT_CONTEXT_USE_CUB_ALLOCATOR==1 |
| 321 | if (memory != nullptr) { |
| 322 | CUMAT_SAFE_CALL(getCubAllocator().DeviceFree(device_, memory)); |
| 323 | } |
| 324 | #else |
| 325 | CUMAT_SAFE_CALL(cudaFree(memory)); |
| 326 | #endif |
| 327 | } |
| 328 | |
| 329 | #if CUMAT_CONTEXT_DEBUG_MEMORY==1 |
| 330 | //For testing only |
no outgoing calls
no test coverage detected