TMemFile default size

Dear all,
Dear @dpiparo,

We want to use TMemFile to create a TFile in memory and send it to a database which will then dump it on disk. It is important that the client does not hit the disk, thus the use of TMemFile instead of TFile.

In the present incarnation of TMemFile, it seems that the minimum size of the buffer is 2MB. We expected the parameter defBlockSize to influence this size but it does not seem to be the case.

TH1F h1("asdf", "adf", 20, 0, 19);
TMemFile m("memfile.root", "CREATE", "", ROOT::RCompressionSetting::EDefaults::kUseGeneralPurpose, 1024);
m.WriteObject(&h1, "Digit");
std::cout << "TMemFile size " << m.GetSize() << "\n";
// TMemFile size 2097152

Are we doing it wrong ? How can we have a smaller file size ?
Thank you,
Barth and Sandro

ROOT Version: 6.18
Platform: Mac and CC7
Compiler: gcc and clang

There was an unfortunate bug in the code that meant that the size you gave was not used when allocating the first block …


Thank you, Philippe, for the extremely quick reaction !

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