Hi,
Sorry for the delay. It turns out the information in my header was wrong with regard to the compiler, at least on lxplus. I was originally loading a view compiled with GCC6.2 (source /cvmfs/sft.cern.ch/lcg/views/setupViews.sh LCG_90 x86_64-centos7-gcc62-opt). My local version was compiled by my IT department with GCC8.2.
I should note that I found this issue first on my local centos7 machine, where the problem is more evident, but I found a similar behavior on lxplus.
I use free -h to gather current memory use, run my macro, then use free -h again. What I found is that my buff/cache increases by my file size and free decreases by the same amount. On my local machine, once free gets close to zero my read speed slows dramatically. On lxplus there seems to be much more complex memory management in place, so the problem is less pronounced.
Here is an example from my local machine. You can see the first time I run the macro my buff/cache increases, but the second time I run there is no increase. I know that’s the cache doing its job, but the issue comes when it’s full. I have many of these files to process and I really don’t need to cache them.
[clantz2@phenix-03 JZCaPA]$ free -h
total used free shared buff/cache available
Mem: 7.6G 860M 4.7G 46M 2.1G 6.3G
Swap: 4.0G 0B 4.0G
[clantz2@phenix-03 JZCaPA]$ root -l LeakMemory.cpp
root [0]
Processing LeakMemory.cpp...
Event 100, RAM: 3.0/ 7.6GB
Event 15600, RAM: 4.5/ 7.6GB
root [1]
root [1] .q
[clantz2@phenix-03 JZCaPA]$ free -h
total used free shared buff/cache available
Mem: 7.6G 862M 3.2G 46M 3.6G 6.3G
Swap: 4.0G 0B 4.0G
[clantz2@phenix-03 JZCaPA]$ root -l LeakMemory.cpp
root [0]
Processing LeakMemory.cpp...
Event 15600, RAM: 4.5/ 7.6GB
root [1] .q
[clantz2@phenix-03 JZCaPA]$ free -h
total used free shared buff/cache available
Mem: 7.6G 864M 3.2G 46M 3.6G 6.3G
Swap: 4.0G 0B 4.0G
I have reproduced the issue with your view, Enrico. First I had to keep logging into lxplus to find a machine that showed some free memory. It seems they are often fully utilized. Once I was on one that showed some free, I executed the following:
[clantz@lxplus725 ~]$ source /cvmfs/sft.cern.ch/lcg/views/LCG_95a/x86_64-centos7-gcc8-opt/setup.sh
During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C"
2: Setting LC_COLLATE failed, using "C"
3: Setting LC_TIME failed, using "C"
4: Setting LC_MESSAGES failed, using "C"
5: Setting LC_MONETARY failed, using "C"
6: Setting LC_PAPER failed, using "C"
7: Setting LC_MEASUREMENT failed, using "C"
During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C"
2: Setting LC_COLLATE failed, using "C"
3: Setting LC_TIME failed, using "C"
4: Setting LC_MESSAGES failed, using "C"
5: Setting LC_MONETARY failed, using "C"
6: Setting LC_PAPER failed, using "C"
7: Setting LC_MEASUREMENT failed, using "C"
During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C"
2: Setting LC_COLLATE failed, using "C"
3: Setting LC_TIME failed, using "C"
4: Setting LC_MESSAGES failed, using "C"
5: Setting LC_MONETARY failed, using "C"
6: Setting LC_PAPER failed, using "C"
7: Setting LC_MEASUREMENT failed, using "C"
During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C"
2: Setting LC_COLLATE failed, using "C"
3: Setting LC_TIME failed, using "C"
4: Setting LC_MESSAGES failed, using "C"
5: Setting LC_MONETARY failed, using "C"
6: Setting LC_PAPER failed, using "C"
7: Setting LC_MEASUREMENT failed, using "C"
[clantz@lxplus725 ~]$ free -h
total used free shared buff/cache available
Mem: 28G 7.4G 11G 193M 9.3G 20G
Swap: 9G 405M 9.6G
[clantz@lxplus725 ~]$ root -l LeakMemory.cpp
root [0]
Processing LeakMemory.cpp...
Event 100, RAM:17.2/28.6GB
Event 15500, RAM:19.3/28.6GB
root [1]
root [1] .q
[clantz@lxplus725 ~]$ free -h
total used free shared buff/cache available
Mem: 28G 7.3G 9.3G 193M 12G 20G
Swap: 9G 405M 9.6G
[clantz@lxplus725 ~]$ root -l LeakMemory.cpp
root [0]
Processing LeakMemory.cpp...
Event 15500, RAM:19.3/28.6GB
root [1] .q
[clantz@lxplus725 ~]$ free -h
total used free shared buff/cache available
Mem: 28G 7.2G 9.3G 193M 12G 20G
Swap: 9G 405M 9.6G
I’m not sure what these warning messages are, but the behavior is similar. A buffer increase on the first run, and no increase on the second. I’ve also noticed that lxplus seems to free memory on demand once it has been filled, so filling the buffer doesn’t really have a negative effect.