Skip to content

Commit 1871e1b

Browse files
committed
fix for running without packedcopy
1 parent ea3bc6c commit 1871e1b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/ConsumerFMQchannel.cxx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -885,13 +885,17 @@ int ConsumerFMQchannel::DDformatMessage(DataSetReference &bc, DDMessage &ddm) {
885885
}
886886
DataBlockContainerReference copyBlock = nullptr;
887887
int isNewBlock = 0;
888+
int copyBlockMemSize = 0;
888889
try {
889890
if (enablePackedCopy) {
890891
for (int i = 0; i<=2; i++) {
891892
// allocate new buffer for copies if needed
892893
if (copyBlockBuffer == nullptr) {
893894
copyBlockBuffer = mp->getNewDataBlockContainer();
894895
isNewBlock = 1;
896+
if (copyBlockBuffer != nullptr) {
897+
copyBlockMemSize = copyBlockBuffer->getDataBufferSize();
898+
}
895899
nPagesUsedForRepack++;
896900
continue;
897901
}
@@ -906,6 +910,9 @@ int ConsumerFMQchannel::DDformatMessage(DataSetReference &bc, DDMessage &ddm) {
906910
} else {
907911
copyBlock = mp->getNewDataBlockContainer();
908912
isNewBlock = 1;
913+
if (copyBlock != nullptr) {
914+
copyBlockMemSize = copyBlock->getDataBufferSize();
915+
}
909916
nPagesUsedForRepack++;
910917
}
911918
} catch (...) {
@@ -916,10 +923,8 @@ int ConsumerFMQchannel::DDformatMessage(DataSetReference &bc, DDMessage &ddm) {
916923
theLog.log(token, "no page left");
917924
throw __LINE__;
918925
}
919-
int copyBlockMemSize = 0;
920926
if (isNewBlock) {
921-
ddm.subTimeframeMemorySize += copyBlockBuffer->getDataBufferSize();
922-
copyBlockMemSize = copyBlockBuffer->getDataBufferSize();
927+
ddm.subTimeframeMemorySize += copyBlockMemSize;
923928
//printf("%d size 1 TF %d block %p mem size %d %d\n", __LINE__, (int)copyBlock->getData()->header.timeframeId, copyBlock->getData(), (int)copyBlockBuffer->getDataBufferSize(), copyBlock->getData()->header.memorySize);
924929
}
925930
auto blockRef = new DataBlockContainerReference(copyBlock);

0 commit comments

Comments
 (0)