mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-25 13:42:54 -05:00
replace new/delete with sp
This commit is contained in:
@@ -38,17 +38,6 @@ std::mutex KPCache::s_cacheMutex;
|
||||
KPCache KPCache::s_cache;
|
||||
|
||||
|
||||
KPCache::KPCache()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
KPCache::~KPCache()
|
||||
{
|
||||
delete m_memory;
|
||||
}
|
||||
|
||||
|
||||
bool KPCache::init(uint32_t epoch)
|
||||
{
|
||||
if (epoch >= sizeof(cache_sizes) / sizeof(cache_sizes[0])) {
|
||||
@@ -63,8 +52,7 @@ bool KPCache::init(uint32_t epoch)
|
||||
|
||||
const size_t size = cache_sizes[epoch];
|
||||
if (!m_memory || m_memory->size() < size) {
|
||||
delete m_memory;
|
||||
m_memory = new VirtualMemory(size, false, false, false);
|
||||
m_memory = std::make_shared<VirtualMemory>(size, false, false, false);
|
||||
}
|
||||
|
||||
const ethash_h256_t seedhash = ethash_get_seedhash(epoch);
|
||||
|
||||
@@ -41,8 +41,8 @@ public:
|
||||
|
||||
XMRIG_DISABLE_COPY_MOVE(KPCache)
|
||||
|
||||
KPCache();
|
||||
~KPCache();
|
||||
KPCache() = default;
|
||||
~KPCache() = default;
|
||||
|
||||
bool init(uint32_t epoch);
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
static KPCache s_cache;
|
||||
|
||||
private:
|
||||
VirtualMemory* m_memory = nullptr;
|
||||
std::shared_ptr<VirtualMemory> m_memory;
|
||||
size_t m_size = 0;
|
||||
uint32_t m_epoch = 0xFFFFFFFFUL;
|
||||
std::vector<uint32_t> m_DAGCache;
|
||||
|
||||
Reference in New Issue
Block a user