|
|
@@ -47,6 +47,17 @@ static_assert(ARGON2_BLOCK_SIZE == randomx::ArgonBlockSize, "Unpexpected value o
|
|
|
|
|
|
namespace randomx {
|
|
|
|
|
|
+ template<class Allocator>
|
|
|
+ void deallocCache(randomx_cache* cache) {
|
|
|
+ if (cache->memory != nullptr)
|
|
|
+ Allocator::freeMemory(cache->memory, CacheSize);
|
|
|
+ if (cache->jit != nullptr)
|
|
|
+ delete cache->jit;
|
|
|
+ }
|
|
|
+
|
|
|
+ template void deallocCache<DefaultAllocator>(randomx_cache* cache);
|
|
|
+ template void deallocCache<LargePageAllocator>(randomx_cache* cache);
|
|
|
+
|
|
|
void initCache(randomx_cache* cache, const void* key, size_t keySize) {
|
|
|
uint32_t memory_blocks, segment_length;
|
|
|
argon2_instance_t instance;
|