Destroy randomx VM when we are done with it
This commit is contained in:
@@ -1066,6 +1066,7 @@ void static RandomXMiner()
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
randomx_flags flags = randomx_get_flags();
|
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_LARGE_PAGES;
|
||||||
flags |= RANDOMX_FLAG_FULL_MEM;
|
flags |= RANDOMX_FLAG_FULL_MEM;
|
||||||
//flags |= RANDOMX_FLAG_JIT;
|
//flags |= RANDOMX_FLAG_JIT;
|
||||||
@@ -1175,8 +1176,6 @@ void static RandomXMiner()
|
|||||||
|
|
||||||
randomx_init_dataset(randomxDataset, randomxCache, 0, datasetItemCount);
|
randomx_init_dataset(randomxDataset, randomxCache, 0, datasetItemCount);
|
||||||
rxdebug("%s: dataset initialized\n");
|
rxdebug("%s: dataset initialized\n");
|
||||||
// randomx_release_cache(randomxCache);
|
|
||||||
// rxdebug("%s: cache released\n");
|
|
||||||
|
|
||||||
randomx_vm *myVM = randomx_create_vm(flags, nullptr, randomxDataset);
|
randomx_vm *myVM = randomx_create_vm(flags, nullptr, randomxDataset);
|
||||||
if(myVM == NULL) {
|
if(myVM == NULL) {
|
||||||
@@ -1286,9 +1285,6 @@ void static RandomXMiner()
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
//randomx_destroy_vm(myVM);
|
|
||||||
//rxdebug("%s: destroyed VM\n");
|
|
||||||
|
|
||||||
// Use randomx hash to build a valid block
|
// Use randomx hash to build a valid block
|
||||||
std::function<bool(std::vector<unsigned char>)> validBlock =
|
std::function<bool(std::vector<unsigned char>)> validBlock =
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
@@ -1396,6 +1392,11 @@ void static RandomXMiner()
|
|||||||
pblock->nNonce = ArithToUint256(UintToArith256(pblock->nNonce) + 1);
|
pblock->nNonce = ArithToUint256(UintToArith256(pblock->nNonce) + 1);
|
||||||
pblock->nBits = savebits;
|
pblock->nBits = savebits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rxdebug("%s: going to destroy rx VM\n");
|
||||||
|
randomx_destroy_vm(myVM);
|
||||||
|
rxdebug("%s: destroyed VM\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user