# After running Update(), the RTK memory is not release

**URL:** https://discourse.itk.org/t/after-running-update-the-rtk-memory-is-not-release/7543
**Category:** Engineering
**Created:** [May 27, 2025, 10:52am UTC](https://discourse.itk.org/t/after-running-update-the-rtk-memory-is-not-release/7543 "2025-05-27T10:52:18Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![langzhizhen](https://discourse.itk.org/user_avatar/discourse.itk.org/langzhizhen/32/4468_2.png) [@langzhizhen](https://discourse.itk.org/u/langzhizhen)
#### Post date: [May 27, 2025, 10:52am UTC](https://discourse.itk.org/t/after-running-update-the-rtk-memory-is-not-release/7543/1 "2025-05-27T10:52:18Z")

</div>

Hello, I built a rtk class using python and then wrapped the forward() and FDKbackward(). When I was doing forward and backward, I noticed that the memory usage was rising. I used python’s memory\_profiler tool to analyze the memory usage and found that the Update() function takes up some memory but does not free it after the function ends. Even though I manually del deleted the variable, it still doesn’t work.  
this is my code:

```auto
FDKType = rtk.CudaFDKConeBeamReconstructionFilter
fdk = FDKType.New()
fdk.Update()
image_gpu = fdk.GetOutput()
image = self.cuda2cpu(image_gpu)
del fdk
gc.collect()

and
fp = rtk.CudaForwardProjectionImageFilter.New()
fp.Update()
del fp

```

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [May 27, 2025, 1:15pm UTC](https://discourse.itk.org/t/after-running-update-the-rtk-memory-is-not-release/7543/2 "2025-05-27T13:15:08Z")

</div>

@simon.rit might want to comment.

---

<div class="post-metadata">

### Author: ![simon.rit](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/f08c70/32.png) [@simon.rit](https://discourse.itk.org/u/simon.rit)
#### Post date: [May 27, 2025, 1:32pm UTC](https://discourse.itk.org/t/after-running-update-the-rtk-memory-is-not-release/7543/3 "2025-05-27T13:32:53Z")

</div>

Most of the (CPU and GPU) memory is contained in the `image_gpu` object, `CudaFDKConeBeamReconstructionFilter` does not use much memory. So if you don’t delete this one, I don’t expect a huge release of memory.

Could you provide a full self-contained example along with the RTK version to be able to reproduce the issue?

---

<div class="post-metadata">

### Author: ![langzhizhen](https://discourse.itk.org/user_avatar/discourse.itk.org/langzhizhen/32/4468_2.png) [@langzhizhen](https://discourse.itk.org/u/langzhizhen)
#### Post date: [May 28, 2025, 3:07am UTC](https://discourse.itk.org/t/after-running-update-the-rtk-memory-is-not-release/7543/4 "2025-05-28T03:07:41Z")

</div>

> [@simon.rit](#):
>
> Most of the (CPU and GPU) memory is contained in the `image_gpu` object

Thank you for your reply. Your reference to “Most of the (CPU and GPU) memory is contained in the image\_gpu object” is very helpful. I try to delete forward() and backward() outputs and find that it really release a lot of memory!
