int MemoryPool::push(void *p, size_t s, int loc) { if ((s > MIN_BLOCK_SIZE) && (s < MAX_BLOCK_SIZE)) { locker_.lock(); if ((pool_depth_ + s < max_pool_depth_)) { pool_.emplace(s, p); pool_depth_ += s; p = nullptr; } locker_.unlock(); if (p != nullptr) { #ifdef __CUDA__ SP_DEVICE_CALL(cudaFree(p)); #else free(p); #endif } } return SP_SUCCESS; // VERBOSE << SHORT_FILE_LINE_STAMP << "Free MemoryPool [" << s << " ]" << std::endl; }