From c55d1cbc5f484e95f5e0f573e43aa4ce93dd795f Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Tue, 15 Nov 2022 14:02:02 -0500 Subject: [PATCH] Destroy randomx VM when we are done with it --- src/miner.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 1b030ea18..c1f6f73b6 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -1066,6 +1066,7 @@ void static RandomXMiner() } ); randomx_flags flags = randomx_get_flags(); + // TODO: attempt to use large pages and fall back to no large pages // flags |= RANDOMX_FLAG_LARGE_PAGES; flags |= RANDOMX_FLAG_FULL_MEM; //flags |= RANDOMX_FLAG_JIT; @@ -1175,8 +1176,6 @@ void static RandomXMiner() randomx_init_dataset(randomxDataset, randomxCache, 0, datasetItemCount); rxdebug("%s: dataset initialized\n"); - // randomx_release_cache(randomxCache); - // rxdebug("%s: cache released\n"); randomx_vm *myVM = randomx_create_vm(flags, nullptr, randomxDataset); if(myVM == NULL) { @@ -1286,9 +1285,6 @@ void static RandomXMiner() printf("\n"); } - //randomx_destroy_vm(myVM); - //rxdebug("%s: destroyed VM\n"); - // Use randomx hash to build a valid block std::function)> validBlock = #ifdef ENABLE_WALLET @@ -1396,6 +1392,11 @@ void static RandomXMiner() pblock->nNonce = ArithToUint256(UintToArith256(pblock->nNonce) + 1); pblock->nBits = savebits; } + + rxdebug("%s: going to destroy rx VM\n"); + randomx_destroy_vm(myVM); + rxdebug("%s: destroyed VM\n"); + }