Skip to content
Snippets Groups Projects
Unverified Commit 3c50a651 authored by Guilherme Amadio's avatar Guilherme Amadio
Browse files

io: use TBufferFile with same size as TBufferMergerFile

Using nbytes we get a buffer only as big as last thing
written with TMemFile::Write(), which causes many memory
allocations to expand the TBufferFile to the same size
as the TBufferMergerFile. Related JIRA issue: ROOT-9133.
parent 2b54b2ef
No related branches found
No related tags found
No related merge requests found
...@@ -32,7 +32,7 @@ Int_t TBufferMergerFile::Write(const char *name, Int_t opt, Int_t bufsize) ...@@ -32,7 +32,7 @@ Int_t TBufferMergerFile::Write(const char *name, Int_t opt, Int_t bufsize)
Int_t nbytes = TMemFile::Write(name, opt, bufsize); Int_t nbytes = TMemFile::Write(name, opt, bufsize);
if (nbytes) { if (nbytes) {
TBufferFile *buffer = new TBufferFile(TBuffer::kWrite, nbytes); TBufferFile *buffer = new TBufferFile(TBuffer::kWrite, GetSize());
CopyTo(*buffer); CopyTo(*buffer);
buffer->SetReadMode(); buffer->SetReadMode();
fMerger.Push(buffer); fMerger.Push(buffer);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment