# Memory is increasing when add then delete sphere source repeatedly

**URL:** https://discourse.paraview.org/t/memory-is-increasing-when-add-then-delete-sphere-source-repeatedly/2087
**Category:** Development
**Created:** [June 22, 2019, 1:26pm UTC](https://discourse.paraview.org/t/memory-is-increasing-when-add-then-delete-sphere-source-repeatedly/2087 "2019-06-22T13:26:52Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![sharon](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/s/67e7ee/32.png) [@sharon](https://discourse.paraview.org/u/sharon)
#### Post date: [June 22, 2019, 1:26pm UTC](https://discourse.paraview.org/t/memory-is-increasing-when-add-then-delete-sphere-source-repeatedly/2087/1 "2019-06-22T13:26:52Z")

</div>

Dear Experts,

I am adding and deleting sphere source with resolution 80000, and open memory inspector to monitor the memory change, i found the memory is increasing all the time…

What i expect is the memory should not increase after i delete the source

How to fix this issues?

Thanks and Best Regards,

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [June 25, 2019, 9:34am UTC](https://discourse.paraview.org/t/memory-is-increasing-when-add-then-delete-sphere-source-repeatedly/2087/2 "2019-06-25T09:34:43Z")

</div>

Using this [script](https://discourse.paraview.org/uploads/default/original/2X/1/15feb83449e18e8fe1ad002bf83ecf55e44348e1.py) (2.0 KB) as a macro, I was able to reproduce the behavior for the first 10 spheres, 10Mb of memory by sphere, but it then stops increasing.

Do you see the same behavior ?

This should not happen ideally, but not critical imo.

---

<div class="post-metadata">

### Author: ![wascott](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/w/8e8cbc/32.png) [@wascott](https://discourse.paraview.org/u/wascott)
#### Post date: [June 25, 2019, 6:07pm UTC](https://discourse.paraview.org/t/memory-is-increasing-when-add-then-delete-sphere-source-repeatedly/2087/3 "2019-06-25T18:07:01Z")

</div>

I wonder if this has to do with ParaView’s memory handling code. I believe i was told that ParaView doesn’t “return” memory that it uses to the system, but it does know when it’s free, and adds it to the free memory pool to be used. An example where this works correctly, but is really confisuing, is remote server if you open something large, delete it, and open something large a second time. The big no-no is memory should never grow until we crash. And, from Mathieu;s experiments, sounds like it doesn’t.

---

<div class="post-metadata">

### Author: ![sharon](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/s/67e7ee/32.png) [@sharon](https://discourse.paraview.org/u/sharon)
#### Post date: [June 27, 2019, 12:26am UTC](https://discourse.paraview.org/t/memory-is-increasing-when-add-then-delete-sphere-source-repeatedly/2087/4 "2019-06-27T00:26:18Z")

</div>

Thank you Mathieu for your reply!

i am not good at python script, i did it manually, i did not make it reach 10M, just tried several times.

What confused me is why paraview failed to release memory after i delete the object in pipeline browser…?

In my situation, very big memory is needed, so such memory increase is unacceptable… any suggestions or ideas ?

Thanks a lot!

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [June 28, 2019, 1:24pm UTC](https://discourse.paraview.org/t/memory-is-increasing-when-add-then-delete-sphere-source-repeatedly/2087/5 "2019-06-28T13:24:07Z")

</div>

Your example usecase uses maximum 600Mo, hardly too much memory.  
What are the numbers of your real usecase ?

---

<div class="post-metadata">

### Author: ![sharon](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/s/67e7ee/32.png) [@sharon](https://discourse.paraview.org/u/sharon)
#### Post date: [June 29, 2019, 2:43am UTC](https://discourse.paraview.org/t/memory-is-increasing-when-add-then-delete-sphere-source-repeatedly/2087/6 "2019-06-29T02:43:23Z")

</div>

Hi Mathieu,  
How to manage memory in paraview elegantly?  
Why after I delete object in pipeline browser, the memory is not released?
