summaryrefslogtreecommitdiffstats
path: root/xmrstak/backend/cpu/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'xmrstak/backend/cpu/crypto')
-rw-r--r--xmrstak/backend/cpu/crypto/cryptonight_common.cpp11
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)
{
OpenPOWER on IntegriCloud