Skip to content

[io] reduce compression buffer length #18449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions io/io/src/TKey.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ TKey::TKey(const TObject *obj, const char *name, Int_t bufsize, TDirectory* moth
ROOT::RCompressionSetting::EAlgorithm::EValues cxAlgorithm = static_cast<ROOT::RCompressionSetting::EAlgorithm::EValues>(GetFile() ? GetFile()->GetCompressionAlgorithm() : 0);
if (cxlevel > 0 && fObjlen > 256) {
Int_t nbuffers = 1 + (fObjlen - 1)/kMAXZIPBUF;
Int_t buflen = TMath::Max(512,fKeylen + fObjlen + 9*nbuffers + 28); //add 28 bytes in case object is placed in a deleted gap
Int_t buflen = TMath::Max(512, fKeylen + fObjlen);
fBuffer = new char[buflen];
char *objbuf = fBufferRef->Buffer() + fKeylen;
char *bufcur = &fBuffer[fKeylen];
Expand Down Expand Up @@ -343,7 +343,7 @@ TKey::TKey(const void *obj, const TClass *cl, const char *name, Int_t bufsize, T
ROOT::RCompressionSetting::EAlgorithm::EValues cxAlgorithm = static_cast<ROOT::RCompressionSetting::EAlgorithm::EValues>(GetFile() ? GetFile()->GetCompressionAlgorithm() : 0);
if (cxlevel > 0 && fObjlen > 256) {
Int_t nbuffers = 1 + (fObjlen - 1)/kMAXZIPBUF;
Int_t buflen = TMath::Max(512,fKeylen + fObjlen + 9*nbuffers + 28); //add 28 bytes in case object is placed in a deleted gap
Int_t buflen = TMath::Max(512, fKeylen + fObjlen);
fBuffer = new char[buflen];
char *objbuf = fBufferRef->Buffer() + fKeylen;
char *bufcur = &fBuffer[fKeylen];
Expand Down
2 changes: 1 addition & 1 deletion io/xml/src/TBufferXML.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ void TBufferXML::XmlWriteBlock(XMLNodePointer_t node)

if ((Length() > 512) && (compressionLevel > 0)) {
int zipBufferSize = Length();
fZipBuffer = new char[zipBufferSize + 9];
fZipBuffer = new char[zipBufferSize];
int dataSize = Length();
int compressedSize = 0;
R__zipMultipleAlgorithm(compressionLevel, &dataSize, Buffer(), &zipBufferSize, fZipBuffer, &compressedSize,
Expand Down
2 changes: 1 addition & 1 deletion net/net/src/TMessage.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ Int_t TMessage::Compress()
Int_t messlen = Length() - hdrlen;
Int_t nbuffers = 1 + (messlen - 1) / kMAXZIPBUF;
Int_t chdrlen = 3*sizeof(UInt_t); // compressed buffer header length
Int_t buflen = std::max(512, chdrlen + messlen + 9*nbuffers);
Int_t buflen = std::max(512, chdrlen + messlen);
fBufComp = new char[buflen];
char *messbuf = Buffer() + hdrlen;
char *bufcur = fBufComp + chdrlen;
Expand Down
2 changes: 1 addition & 1 deletion tree/tree/src/TBasket.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1218,7 +1218,7 @@ Int_t TBasket::WriteBuffer()
cxAlgorithm = static_cast<ROOT::RCompressionSetting::EAlgorithm::EValues>(file->GetCompressionAlgorithm());
if (cxlevel > 0) {
Int_t nbuffers = 1 + (fObjlen - 1) / kMAXZIPBUF;
Int_t buflen = fKeylen + fObjlen + 9 * nbuffers + 28; //add 28 bytes in case object is placed in a deleted gap
Int_t buflen = fKeylen + fObjlen;
InitializeCompressedBuffer(buflen, file);
if (!fCompressedBufferRef) {
Warning("WriteBuffer", "Unable to allocate the compressed buffer");
Expand Down
Loading