Better fix for memory allocation, thanks @SChernykh.

This commit is contained in:
XMRig 2019-01-21 17:27:45 +07:00
parent 046c345f65
commit f478fa843d

View file

@ -41,19 +41,9 @@ MemInfo Mem::create(cryptonight_ctx **ctx, xmrig::Algo algorithm, size_t count)
MemInfo info; MemInfo info;
info.size = cn_select_memory(algorithm) * count; info.size = cn_select_memory(algorithm) * count;
# ifndef XMRIG_NO_AEON constexpr const size_t align_size = 2 * 1024 * 1024;
if (algorithm == xmrig::CRYPTONIGHT_LITE) { info.size = ((info.size + align_size - 1) / align_size) * align_size;
info.size += info.size % cn_select_memory<CRYPTONIGHT>(); info.pages = info.size / align_size;
}
# endif
# ifndef XMRIG_NO_CN_PICO
if (algorithm == xmrig::CRYPTONIGHT_PICO) {
info.size = cn_select_memory<CRYPTONIGHT>();
}
# endif
info.pages = info.size / cn_select_memory<CRYPTONIGHT>();
allocate(info, m_enabled); allocate(info, m_enabled);