Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
chaithyagr committed Aug 29, 2024
1 parent 2de0511 commit 5e267bb
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 5e267bb

Please sign in to comment.