# Significantly increased memory consumption of StandardHypoTestInvDemo.C in 6.20/06 compared to 6.14/04

**URL:** <https://root-forum.cern.ch/t/significantly-increased-memory-consumption-of-standardhypotestinvdemo-c-in-6-20-06-compared-to-6-14-04/44405>\
**Category:** Roofit and RooStats\
**Created:** [April 13, 2021, 3:59pm UTC](https://root-forum.cern.ch/t/significantly-increased-memory-consumption-of-standardhypotestinvdemo-c-in-6-20-06-compared-to-6-14-04/44405 "2021-04-13T15:59:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![yus](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/y/9fc348/32.png) [@yus](https://root-forum.cern.ch/u/yus)\
**Post date:** [April 13, 2021, 3:59pm UTC](https://root-forum.cern.ch/t/significantly-increased-memory-consumption-of-standardhypotestinvdemo-c-in-6-20-06-compared-to-6-14-04/44405/1 "2021-04-13T15:59:53Z")

</div>

Hi,

I noticed that running [StandardHypoTestInvDemo.C](https://root.cern.ch/root/html534/tutorials/roostats/StandardHypoTestInvDemo.C.html) in ROOT 6.20/06 leads to a much larger memory consumption compared to 6.14/04:

```auto
-------------------------------------------------
		| Maximum resident set size [Mbytes] |
N toys	|-------------------+-------------------|
		|	ROOT 6.14/04	|	ROOT 6.20/06	|
--------+-------------------+-------------------|
  10	| 165 | 270 |
 100 | 310 | 865 |
 200	| 483 | 1151 |
 500	| 991 | 3537 |
1000	| 1835 | 6866 |
------------------------------------------------

```

The input (apart from the number of toys) is the same. The maximum resident set size was measured on `lxplus` with

```bash
/usr/bin/time --verbose root.exe -l -b -q StandardHypoTestInvDemo.C

```

How safe is it to keep using 6.14/04? I have problems running it in 6.20/06 on some platforms due to high memory consumption. Also, please note that in both 6.14/04 and 6.20/06 I use the ROOT5 version of `StandardHypoTestInvDemo.C`, and not the ROOT6 one (due to historical reasons) - do you think it’ll matter in the end?

Thanks!

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [April 14, 2021, 9:39am UTC](https://root-forum.cern.ch/t/significantly-increased-memory-consumption-of-standardhypotestinvdemo-c-in-6-20-06-compared-to-6-14-04/44405/2 "2021-04-14T09:39:07Z")

</div>

Hi ,  
Thank you for your report, I will check it later today, what could be the cause of this extra memory usage.  
In principle, if the API has not changed, you should be able to use the ROOT5 version of the macro using ROOT6 Roostats code.  
Can you also please star the workspace you have used for getting these memory values, since this might also depend on the model ? And which parameter did you pass to the macro ? (e.g. type of calculator, test statistics, etc…)

Lorenzo

---

<div class="post-metadata">

**Author:** ![yus](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/y/9fc348/32.png) [@yus](https://root-forum.cern.ch/u/yus)\
**Post date:** [April 14, 2021, 2:23pm UTC](https://root-forum.cern.ch/t/significantly-increased-memory-consumption-of-standardhypotestinvdemo-c-in-6-20-06-compared-to-6-14-04/44405/3 "2021-04-14T14:23:34Z")

</div>

Hi Lorenzo,

thanks for looking into it! I upload a tarball with all the needed files: [files.tgz](https://root-forum.cern.ch/uploads/short-url/k8gY5OllMDJKPPFMHO4V6ikQpSq.tgz) (18.6 KB)  
After you untar it, you do

```bash
hist2workspace ABCD_full13TeV_sample5.xml

```

, then you change the number of toys from 1000 to XXX (anything you want, see my table in the first post):

```bash
sed -i 's/int ntoys = 1000/int ntoys = XXX/' StandardHypoTestInvDemo.C

```

and run:

```bash
root -l -b -q "StandardHypoTestInvDemo.C(5)"

```

All the parameters I use are in this file: frequentist calculator, one-sided profile-likelihood statistics, etc.

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [April 15, 2021, 9:37am UTC](https://root-forum.cern.ch/t/significantly-increased-memory-consumption-of-standardhypotestinvdemo-c-in-6-20-06-compared-to-6-14-04/44405/4 "2021-04-15T09:37:25Z")

</div>

Hi,  
Thanks for sharing the files. I see you have few errors in your model and the toys seem to have a problem fitting. However I can produce the memory increase between 6.14 and current master also by using the tutorial histfactory model, `example_combined_GaussExample_model.root` generated from `example.xml` existing in `tutorials/histfactory`.  
I see in 6.14 the memory usage is stable with number of toys in that case, while in newer version is increasing, indicating a possible memory leak. I will investigate…  
Thanks for reporting this

Lorenzo

Cheers

Lorenzo

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [April 15, 2021, 2:31pm UTC](https://root-forum.cern.ch/t/significantly-increased-memory-consumption-of-standardhypotestinvdemo-c-in-6-20-06-compared-to-6-14-04/44405/5 "2021-04-15T14:31:23Z")

</div>

I have opened a github issue to track this memory leak introduced in 6.16.  
See [Memory leak when running FrequentistCalculator scan in RooStats · Issue #7890 · root-project/root · GitHub](https://github.com/root-project/root/issues/7890)

---

<div class="post-metadata">

**Author:** ![yus](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/y/9fc348/32.png) [@yus](https://root-forum.cern.ch/u/yus)\
**Post date:** [April 15, 2021, 2:34pm UTC](https://root-forum.cern.ch/t/significantly-increased-memory-consumption-of-standardhypotestinvdemo-c-in-6-20-06-compared-to-6-14-04/44405/6 "2021-04-15T14:34:17Z")

</div>

Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [April 29, 2021, 2:34pm UTC](https://root-forum.cern.ch/t/significantly-increased-memory-consumption-of-standardhypotestinvdemo-c-in-6-20-06-compared-to-6-14-04/44405/7 "2021-04-29T14:34:17Z")

</div>

Closed on April 29, 2021, 2:34pm UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
