# Memory problem debugging

**URL:** <https://root-forum.cern.ch/t/memory-problem-debugging/49985>\
**Category:** Newbie\
**Created:** [May 16, 2022, 9:10am UTC](https://root-forum.cern.ch/t/memory-problem-debugging/49985 "2022-05-16T09:10:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ailema](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ailema/32/24027_2.png) [@Ailema](https://root-forum.cern.ch/u/Ailema)\
**Post date:** [May 16, 2022, 9:10am UTC](https://root-forum.cern.ch/t/memory-problem-debugging/49985/1 "2022-05-16T09:10:16Z")

</div>

Dear experts,  
I have a class used for data analysis, and I have some problems with the residual memory which is continuously increasing so I suspect a memory leak ( and I have to remain under the 2.5GB threshold ).  
My task consists of 2 constructors and one destructor, one method that is called once at the beginning of the task, and one that is called for each event.  
I found the ProcInfo\_t and MemInfo\_t data types, and how to print the memory usage of the root process. Now if I print this in each method I can only observe that the memory usage is increasing, but I don’t know how to use this to debug my code properly.

Any ideas are highly welcomed. Thanks!

---

<div class="post-metadata">

**Author:** ![jalopezg](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jalopezg/32/25844_2.png) [@jalopezg](https://root-forum.cern.ch/u/jalopezg)\
**Post date:** [May 16, 2022, 10:57am UTC](https://root-forum.cern.ch/t/memory-problem-debugging/49985/2 "2022-05-16T10:57:52Z")

</div>

Hi @Ailema,

Are you running on a ROOT interpreter session (or are you compiling your code to a standalone executable file)?  
In the latter case, you should be able to use tools such as `memcheck` (from the valgrind project). AddressSanitizer (building your program with `-fsanitize=address`), may also provide some valuable information.

Also, it would be useful if you share a reproducer for your problem.

Cheers,  
J.
