From 3c7fa4aac0e3ee68c9301d73be4a31f5ee36bbac Mon Sep 17 00:00:00 2001 From: Axel Naumann <Axel.Naumann@cern.ch> Date: Tue, 27 Mar 2018 11:48:56 +0200 Subject: [PATCH] Do not duplicate the buffer if using external data. Copying fBlockList from orig.GetEND() is currect in this case: orig has only one TMemBlock, and fExternalData->data() and size() will be the same for any reference to that data. --- io/io/src/TMemFile.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/io/io/src/TMemFile.cxx b/io/io/src/TMemFile.cxx index 5f605521741..e87451ac35d 100644 --- a/io/io/src/TMemFile.cxx +++ b/io/io/src/TMemFile.cxx @@ -194,8 +194,10 @@ TMemFile::TMemFile(const TMemFile &orig) : fD = orig.fD; // not really used, so it is okay to have the same value. fWritable = orig.fWritable; - // We intentionally allocated just one big buffer for this object. - orig.CopyTo(fBlockList.fBuffer,fSize); + if (!fExternalData) { + // We intentionally allocated just one big buffer for this object. + orig.CopyTo(fBlockList.fBuffer,fSize); + } Init(!NeedsExistingFile(optmode)); // A copy is } -- GitLab