summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cuda/3d/astra3d.cu38
-rw-r--r--cuda/3d/mem3d.cu14
2 files changed, 47 insertions, 5 deletions
diff --git a/cuda/3d/astra3d.cu b/cuda/3d/astra3d.cu
index 8e0946e..30cbe1b 100644
--- a/cuda/3d/astra3d.cu
+++ b/cuda/3d/astra3d.cu
@@ -319,6 +319,9 @@ AstraSIRT3d::~AstraSIRT3d()
delete[] pData->projs;
pData->projs = 0;
+ delete[] pData->parprojs;
+ pData->parprojs = 0;
+
cudaFree(pData->D_projData.ptr);
pData->D_projData.ptr = 0;
@@ -702,6 +705,9 @@ AstraCGLS3d::~AstraCGLS3d()
delete[] pData->projs;
pData->projs = 0;
+ delete[] pData->parprojs;
+ pData->parprojs = 0;
+
cudaFree(pData->D_projData.ptr);
pData->D_projData.ptr = 0;
@@ -1133,19 +1139,27 @@ bool astraCudaBP(float* pfVolume, const float* pfProjections,
cudaError_t err = cudaGetLastError();
// Ignore errors caused by calling cudaSetDevice multiple times
- if (err != cudaSuccess && err != cudaErrorSetOnActiveProcess)
+ if (err != cudaSuccess && err != cudaErrorSetOnActiveProcess) {
+ delete[] pParProjs;
+ delete[] pConeProjs;
return false;
+ }
}
cudaPitchedPtr D_volumeData = allocateVolumeData(dims);
ok = D_volumeData.ptr;
- if (!ok)
+ if (!ok) {
+ delete[] pParProjs;
+ delete[] pConeProjs;
return false;
+ }
cudaPitchedPtr D_projData = allocateProjectionData(dims);
ok = D_projData.ptr;
if (!ok) {
+ delete[] pParProjs;
+ delete[] pConeProjs;
cudaFree(D_volumeData.ptr);
return false;
}
@@ -1156,6 +1170,8 @@ bool astraCudaBP(float* pfVolume, const float* pfProjections,
ok &= zeroVolumeData(D_volumeData, dims);
if (!ok) {
+ delete[] pParProjs;
+ delete[] pConeProjs;
cudaFree(D_volumeData.ptr);
cudaFree(D_projData.ptr);
return false;
@@ -1168,6 +1184,8 @@ bool astraCudaBP(float* pfVolume, const float* pfProjections,
ok &= copyVolumeFromDevice(pfVolume, D_volumeData, dims, dims.iVolX);
+ delete[] pParProjs;
+ delete[] pConeProjs;
cudaFree(D_volumeData.ptr);
cudaFree(D_projData.ptr);
@@ -1208,19 +1226,27 @@ bool astraCudaBP_SIRTWeighted(float* pfVolume,
cudaError_t err = cudaGetLastError();
// Ignore errors caused by calling cudaSetDevice multiple times
- if (err != cudaSuccess && err != cudaErrorSetOnActiveProcess)
+ if (err != cudaSuccess && err != cudaErrorSetOnActiveProcess) {
+ delete[] pParProjs;
+ delete[] pConeProjs;
return false;
+ }
}
cudaPitchedPtr D_pixelWeight = allocateVolumeData(dims);
ok = D_pixelWeight.ptr;
- if (!ok)
+ if (!ok) {
+ delete[] pParProjs;
+ delete[] pConeProjs;
return false;
+ }
cudaPitchedPtr D_volumeData = allocateVolumeData(dims);
ok = D_volumeData.ptr;
if (!ok) {
+ delete[] pParProjs;
+ delete[] pConeProjs;
cudaFree(D_pixelWeight.ptr);
return false;
}
@@ -1228,6 +1254,8 @@ bool astraCudaBP_SIRTWeighted(float* pfVolume,
cudaPitchedPtr D_projData = allocateProjectionData(dims);
ok = D_projData.ptr;
if (!ok) {
+ delete[] pParProjs;
+ delete[] pConeProjs;
cudaFree(D_pixelWeight.ptr);
cudaFree(D_volumeData.ptr);
return false;
@@ -1244,6 +1272,8 @@ bool astraCudaBP_SIRTWeighted(float* pfVolume,
processVol3D<opInvert>(D_pixelWeight, dims);
if (!ok) {
+ delete[] pParProjs;
+ delete[] pConeProjs;
cudaFree(D_pixelWeight.ptr);
cudaFree(D_volumeData.ptr);
cudaFree(D_projData.ptr);
diff --git a/cuda/3d/mem3d.cu b/cuda/3d/mem3d.cu
index 97be8a4..ed779fa 100644
--- a/cuda/3d/mem3d.cu
+++ b/cuda/3d/mem3d.cu
@@ -253,6 +253,9 @@ bool FP(const astra::CProjectionGeometry3D* pProjGeom, MemHandle3D projData, con
}
}
+ delete[] pParProjs;
+ delete[] pConeProjs;
+
return ok;
}
@@ -283,6 +286,9 @@ bool BP(const astra::CProjectionGeometry3D* pProjGeom, MemHandle3D projData, con
else
ok &= ConeBP(volData.d->ptr, projData.d->ptr, dims, pConeProjs, params);
+ delete[] pParProjs;
+ delete[] pConeProjs;
+
return ok;
}
@@ -303,11 +309,17 @@ bool FDK(const astra::CProjectionGeometry3D* pProjGeom, MemHandle3D projData, co
pParProjs, pConeProjs,
params);
- if (!ok || !pConeProjs)
+ if (!ok || !pConeProjs) {
+ delete[] pParProjs;
+ delete[] pConeProjs;
return false;
+ }
ok &= FDK(volData.d->ptr, projData.d->ptr, pConeProjs, dims, params, bShortScan, pfFilter);
+ delete[] pParProjs;
+ delete[] pConeProjs;
+
return ok;