Skip to content

Commit 7a12fd3

Browse files
committed
memory size of child block + debug log
1 parent 419328a commit 7a12fd3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/DataBlockContainer.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ class DataBlockContainer
3939
// NB: may use std::bind to add extra arguments
4040

4141
// default constructor
42-
DataBlockContainer(DataBlock* v_data = nullptr, uint64_t v_dataBufferSize = 0) : data(v_data), dataBufferSize(v_dataBufferSize), releaseCallback(nullptr){};
42+
DataBlockContainer(DataBlock* v_data = nullptr, uint64_t v_dataBufferSize = 0) : data(v_data), dataBufferSize(v_dataBufferSize), releaseCallback(nullptr){
43+
#ifdef DATABLOCKCONTAINER_DEBUG
44+
printf("Creating DataBlockContainer @ %p size %d\n", data, (int)v_dataBufferSize);
45+
#endif
46+
};
4347

4448
// this constructor allows to specify a callback which is invoked when container is destroyed
4549
DataBlockContainer(ReleaseCallback v_callback = nullptr, DataBlock* v_data = nullptr, uint64_t v_dataBufferSize = 0) : data(v_data), dataBufferSize(v_dataBufferSize), releaseCallback(v_callback){};
@@ -80,6 +84,7 @@ class DataBlockContainer
8084
DataBlock *b = (DataBlock *)&((char *)parentBlock->getData()->data)[parentBlock->dataBufferUsed];
8185
b->header = defaultDataBlockHeader;
8286
b->header.dataSize = v_dataBufferSizeNeeded;
87+
b->header.memorySize = 0; // if this is a child block, it virtually takes no memory. The memory is owned by the parent block.
8388
b->data = &(((char*)b)[sizeof(DataBlock)]);
8489

8590
#ifdef DATABLOCKCONTAINER_DEBUG

0 commit comments

Comments
 (0)