From 14c4348892de6621f0248d888de58dd614bda8c9 Mon Sep 17 00:00:00 2001 From: Ferdia Date: Fri, 11 Sep 2020 23:04:55 +0200 Subject: Fix memory leak in CUDA 2D par_fp Arrays were dynamically allocated in the function convertAndUploadAngles, but were not deallocated, resulting in a memory leak. At the end of this function I now delete [] these arrays, fixing the memory leak. --- cuda/2d/par_fp.cu | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cuda/2d/par_fp.cu') diff --git a/cuda/2d/par_fp.cu b/cuda/2d/par_fp.cu index ea436c3..aac6cc3 100644 --- a/cuda/2d/par_fp.cu +++ b/cuda/2d/par_fp.cu @@ -251,6 +251,10 @@ static void convertAndUploadAngles(const SParProjection *projs, unsigned int nth cudaMemcpyToSymbol(gC_angle, angles, nth*sizeof(float), 0, cudaMemcpyHostToDevice); cudaMemcpyToSymbol(gC_angle_offset, offsets, nth*sizeof(float), 0, cudaMemcpyHostToDevice); cudaMemcpyToSymbol(gC_angle_detsize, detsizes, nth*sizeof(float), 0, cudaMemcpyHostToDevice); + + delete [] angles; + delete [] offsets; + delete [] detsizes; } -- cgit v1.2.3