Skip to content

Commit aeada1c

Browse files
committed
heavyhash memory leak fix
1 parent 8a07954 commit aeada1c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

heavyhash/cuda_heavyhash.cu

+5-1
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,15 @@ void heavyhash_cpu_setTarget(const void *pTargetIn)
225225
}
226226

227227
__host__
228-
uint32_t heavyhash_cpu_hash(int thr_id, uint32_t threads, uint32_t startNounce, int order)
228+
void heavyhash_init(int thr_id)
229229
{
230230
cudaMalloc(&d_GNonces[thr_id], 2*sizeof(uint32_t));
231231
cudaMallocHost(&h_GNonces[thr_id], 2*sizeof(uint32_t));
232+
}
232233

234+
__host__
235+
uint32_t heavyhash_cpu_hash(int thr_id, uint32_t threads, uint32_t startNounce, int order)
236+
{
233237
uint32_t result = UINT32_MAX;
234238
cudaMemset(d_GNonces[thr_id], 0xff, 2*sizeof(uint32_t));
235239
const uint32_t threadsperblock = 256;

heavyhash/heavyhash.cu

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ extern void heavyhash_cpu_setTarget(const void *pTargetIn);
1111
extern uint32_t heavyhash_cpu_hash(int thr_id, uint32_t threads, uint32_t startNounce, int order);
1212
extern uint32_t heavyhash_getSecNonce(int thr_id, int num);
1313
extern void heavyhash_cpu_free(int thr_id);
14+
extern void heavyhash_init(int thr_id);
15+
1416

1517
extern "C" void heavyhash_hash(void *ohash, const void *input)
1618
{
@@ -59,7 +61,9 @@ extern "C" int scanhash_heavyhash(int thr_id, struct work* work, uint32_t max_no
5961

6062
gpulog(LOG_INFO, thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput);
6163

62-
init[thr_id] = true;
64+
heavyhash_init(thr_id);
65+
66+
init[thr_id] = true;
6367
}
6468

6569
uint32_t _ALIGN(128) endiandata[20];

0 commit comments

Comments
 (0)