Skip to content

Commit

Permalink
Merge pull request #24 from chaithyagr/memleak
Browse files Browse the repository at this point in the history
Fix memory leak
  • Loading branch information
chaithyagr authored Sep 3, 2024
2 parents 2de0511 + 5e267bb commit a8c0838
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions CUDA/inc/gpuNUFFT_operator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,27 @@ class GpuNUFFTOperator

void setKSpaceTraj(Array<DType> kSpaceTraj)
{
if (this->kSpaceTraj.data != NULL)
freeLocalMemberArray(this->kSpaceTraj.data);
this->kSpaceTraj = kSpaceTraj;
}
void setSectorCenters(Array<IndType> sectorCenters)
{
if(this->sectorCenters.data != NULL)
freeLocalMemberArray(this->sectorCenters.data);
this->sectorCenters = sectorCenters;
}
void setSectorDataCount(Array<IndType> sectorDataCount)
{
if(this->sectorDataCount.data != NULL)
freeLocalMemberArray(this->sectorDataCount.data);

this->sectorDataCount = sectorDataCount;
}
void setDataIndices(Array<IndType> dataIndices)
{
if (this->dataIndices.data != NULL)
freeLocalMemberArray(this->dataIndices.data);
this->dataIndices = dataIndices;
}
void setSens(Array<DType2> sens)
Expand All @@ -113,10 +122,14 @@ class GpuNUFFTOperator
}
void setDens(Array<DType> dens)
{
if (this->dens.data != NULL)
freeLocalMemberArray(this->dens.data);
this->dens = dens;
}
void setDeapodizationFunction(Array<DType> deapo)
{
if (this->deapo.data != NULL)
freeLocalMemberArray(this->deapo.data);
this->deapo= deapo;
}

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def build_extension(self, ext):

setup(
name="gpuNUFFT",
version="0.9.0",
version="0.10.0",
description="gpuNUFFT - An open source GPU Library for 3D Gridding and NUFFT",
ext_modules=[
CMakeExtension("gpuNUFFT", sourcedir=os.path.join("CUDA")),
Expand Down

0 comments on commit a8c0838

Please sign in to comment.