Skip to content

Commit

Permalink
free memory after query device
Browse files Browse the repository at this point in the history
  • Loading branch information
justanhduc committed Nov 16, 2020
1 parent c554531 commit 820035e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions client.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ int c_wait_server_commands()
strcat(tmp, ",");
}
putenv(tmp);
free(freeList);
}

run_job(&result);
Expand Down
1 change: 1 addition & 0 deletions gpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ int * getFreeGpuList(int *numFree) {
count++;
j++;
}
cudaDeviceReset();
}
*numFree = count;
return gpuList;
Expand Down
3 changes: 2 additions & 1 deletion jobs.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,8 @@ int next_run_job()
if (p->gpus) {
int numFree;
/* get number of free GPUs at the moment */
getFreeGpuList(&numFree);
int * list = getFreeGpuList(&numFree);
free(list);

/* GPU mem takes some time to be allocated
* if there are many processes in queue,
Expand Down

0 comments on commit 820035e

Please sign in to comment.