Home | News | Documentation | Download

"root -memstat" doesn't work


ROOT Version: 6.22/02
Platform: mac os 10.15.6 (catalina)
Compiler: cling


Hello! I’m trying to debug a script that i suspect has a memory allocation issue at runtime. I discovered from doing “root -h” that there’s an option to track memory usage and statistics by specifying the option “-memstat” in my command. So i’d try something like “root -l -q -memstat mymacro.C++” to do so, and my script won’t even compile, despite including TMemStat.h, and despite successful compilation when not trying to use the -memstat option.

So, i tried to do just “root -memstat” and this also does not work, i get the following output at my screen:

input_line_11:2:6: error: unknown type name ‘TMemStat’
new TMemStat("",100000,5000000);
^

| Welcome to ROOT 6.22/02 https://root.cern |
| © 1995-2020, The ROOT Team; conception: R. Brun, F. Rademakers |
| Built for macosx64 on Aug 17 2020, 12:46:52 |
| From tags/v6-22-02@v6-22-02 |

Try ‘.help’, ‘.demo’, ‘.license’, ‘.credits’, ‘.quit’/’.q’

root [0] .q
input_line_12:2:2: error: ‘TMemStat’ is not a class, namespace, or enumeration
TMemStat::Close()
^
input_line_12:2:2: note: ‘TMemStat’ declared here

I’ve tried googling to get help with this error message, but i haven’t found much. Is there something i’m doing wrong here? Is there any other way to track memory allocation+usage in root while using a specific script that compiles fine, but crashes at runtime?

Thank you

The memstat feature apparently is not part of the ROOT built. You can verify it with root-config --features. If you compile ROOT yourself, you can enable TMemStat with cmake -Dmemstat=on.

@Axel Should memstat be built by default? And if it’s not built, should we remove the memstat option from root.exe?