Skip to content

Commit

Permalink
Address memory leaks
Browse files Browse the repository at this point in the history
1.  Delete normalization factor
2.  Clean up FFT plans at end of each decon
  • Loading branch information
bnorthan committed Apr 10, 2024
1 parent 3a41c83 commit 4877101
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ private static boolean extendAndDeconvolveRichardsonLucyFFT(CLIJ2 clij2, ClearCL
clij2.release(psfExtended);
clij2.release(inputExtended);
clij2.release(deconvolvedExtended);

if (nonCirculant) {
clij2.release(normalization_factor);
}

return true;
}
Expand Down Expand Up @@ -251,7 +255,9 @@ public static boolean runRichardsonLucyGPU(CLIJ2 clij2, ClearCLBuffer gpuImg,
.getDimensions()[1], gpuImg.getDimensions()[2], longPointerImg,
longPointerPSF, longPointerOutput, longPointerNormal, l_context, l_queue,
l_device);


clij2fftWrapper.cleanup();

return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public static native int deconv3d_32f_lp_tv(int iterations, float regularization
long l_context, long l_queuee, long l_device);

public static native int diagnostic();


public static native int cleanup();

public static void load() {
Loader.load();
Expand Down

1 comment on commit 4877101

@imagesc-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/clij2-imglib2-cache-tiled-deconvolution/92331/15

Please sign in to comment.