Browse Source

Destroy randomx VM when we are done with it

rx-largepages
Duke Leto 2 years ago
parent
commit
c55d1cbc5f
  1. 11
      src/miner.cpp

11
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<bool(std::vector<unsigned char>)> 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");
}

Loading…
Cancel
Save