Increasing memory usage by TBranch->Fill()

Dear all,

while debugging my acquisition software I found that the memory usage keeps increasing as the acquisition runs; I believe to have traced back the memory increase to the TBranch->Fill() method.

What I expect Fill() to do is to move data from the memory to the TFile, with functions like FlushBaskets or SetAutoFlush controlling these data transfers. What it seems to happen instead is the memory and the disk both being filled.

To reproduce this behavior, just launch the attached macro inside ROOT and monitor the memory usage in another terminal, using Linux command-line programs like “top” (or equivalent tool). The macro generates 2M fake events (timestamp + counter + 1024 samples for each) and stores them in a ROOT file. The available memory begins to drop, and is restored only when we quit ROOT (CTRL+C).

Is it an expected behavior? Could it be a source of (memory) problems? Could it be an OS-related issue?

[ My system: Ubuntu 12.04/3 LTS, ROOT 5.34. ]

Thanks to anyone who would like to comment this fact :slight_smile:
testFill.C (653 Bytes)