diff options
author | psychocrypt <psychocryptHPC@gmail.com> | 2018-04-08 20:40:54 +0200 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineering.com> | 2018-06-04 21:07:11 +0000 |
commit | 98c95315b3b48d29477b808134e574fbf25ad698 (patch) | |
tree | f45256f8c5d2b30e5a3b3729a496248031b57b33 /xmrstak/backend/cpu/crypto/cryptonight_common.cpp | |
parent | 571e37a9269f71bc5f1c14ad963dee9f89a71ae5 (diff) | |
download | xmr-stak-98c95315b3b48d29477b808134e574fbf25ad698.zip xmr-stak-98c95315b3b48d29477b808134e574fbf25ad698.tar.gz |
refactor scratchpad creation
Use the maximum scratchpad size from before and after the fork.
Diffstat (limited to 'xmrstak/backend/cpu/crypto/cryptonight_common.cpp')
-rw-r--r-- | xmrstak/backend/cpu/crypto/cryptonight_common.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/xmrstak/backend/cpu/crypto/cryptonight_common.cpp b/xmrstak/backend/cpu/crypto/cryptonight_common.cpp index 8c30e2c..5899744 100644 --- a/xmrstak/backend/cpu/crypto/cryptonight_common.cpp +++ b/xmrstak/backend/cpu/crypto/cryptonight_common.cpp @@ -35,6 +35,7 @@ extern "C" #include "xmrstak/jconf.hpp" #include <stdio.h> #include <stdlib.h> +#include <algorithm> #include <malloc.h> @@ -69,7 +70,10 @@ size_t cryptonight_init(size_t use_fast_mem, size_t use_mlock, alloc_msg* msg) cryptonight_ctx* cryptonight_alloc_ctx(size_t use_fast_mem, size_t use_mlock, alloc_msg* msg) { - size_t hashMemSize = cn_select_memory(::jconf::inst()->GetMiningAlgo()); + size_t hashMemSize = std::max( + cn_select_memory(::jconf::inst()->GetMiningAlgo()), + cn_select_memory(::jconf::inst()->GetMiningAlgoRoot()) + ); cryptonight_ctx* ptr = (cryptonight_ctx*)malloc(sizeof(cryptonight_ctx)); @@ -108,7 +112,10 @@ cryptonight_ctx* cryptonight_alloc_ctx(size_t use_fast_mem, size_t use_mlock, al void cryptonight_free_ctx(cryptonight_ctx* ctx) { - size_t hashMemSize = cn_select_memory(::jconf::inst()->GetMiningAlgo()); + size_t hashMemSize = std::max( + cn_select_memory(::jconf::inst()->GetMiningAlgo()), + cn_select_memory(::jconf::inst()->GetMiningAlgoRoot()) + ); if(ctx->ctx_info[0] != 0) { |