# Possible memory leak writing TTrees?

**URL:** <https://root-forum.cern.ch/t/possible-memory-leak-writing-ttrees/38227>\
**Category:** Newbie\
**Created:** [March 2, 2020, 10:30pm UTC](https://root-forum.cern.ch/t/possible-memory-leak-writing-ttrees/38227 "2020-03-02T22:30:29Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![jwruss](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@jwruss](https://root-forum.cern.ch/u/jwruss)\
**Post date:** [March 3, 2020, 10:36pm UTC](https://root-forum.cern.ch/t/possible-memory-leak-writing-ttrees/38227/6 "2020-03-03T22:36:04Z")

</div>

Thank you for your response, Philippe. I find your explanation of AutoSave in comparison to AutoFlush to be very informative.

Your question about if the memory leak really relates to growing TTree size and amadio’s question about the resulting file size has also been helpful. Given the maximum size at which I expect my files to be produced at, it does seem like leak would be elsewhere in the macro.

I have started looking into using valgrind. I have modified what Axel has under “Threading checks” in [his post](https://root-forum.cern.ch/t/valgrind-and-root/28506), including also the flag `--leak-check=full` as described [here](http://pages.cs.wisc.edu/~bart/537/valgrind.html). Something that I would like clarified, though, is if this flag includes the output corresponding to when the flag `--tool=massif` is set? It doesn’t look like I can set both these flags simultaneously?

---

_[View the full topic](https://root-forum.cern.ch/t/possible-memory-leak-writing-ttrees/38227)._
