Skip to content

Commit

Permalink
Merge pull request #1084 from kuzudb/memory-fix
Browse files Browse the repository at this point in the history
fix memory sanitizer problem
  • Loading branch information
acquamarin committed Nov 30, 2022
2 parents bba4027 + 99ae8a3 commit d508950
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 10 deletions.
2 changes: 2 additions & 0 deletions src/include/binder/bound_statement.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class BoundStatement {
public:
explicit BoundStatement(StatementType statementType) : statementType{statementType} {}

virtual ~BoundStatement() = default;

inline StatementType getStatementType() const { return statementType; }

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class BoundDeleteNode {
class BoundDeleteClause : public BoundUpdatingClause {
public:
BoundDeleteClause() : BoundUpdatingClause{ClauseType::DELETE} {};
~BoundDeleteClause() override = default;

inline void addDeleteNode(unique_ptr<BoundDeleteNode> deleteNode) {
deleteNodes.push_back(std::move(deleteNode));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class BoundSetClause : public BoundUpdatingClause {

public:
BoundSetClause() : BoundUpdatingClause{ClauseType::SET} {};
~BoundSetClause() override = default;

inline void addSetItem(expression_pair setItem) { setItems.push_back(std::move(setItem)); }

Expand Down
3 changes: 3 additions & 0 deletions src/include/catalog/catalog_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ struct PropertyNameDataType {
}
PropertyNameDataType(string name, DataType dataType)
: name{std::move(name)}, dataType{std::move(dataType)} {};
virtual ~PropertyNameDataType() = default;

string name;
DataType dataType;
Expand Down Expand Up @@ -60,6 +61,8 @@ struct TableSchema {
TableSchema(string tableName, table_id_t tableID, bool isNodeTable)
: tableName{move(tableName)}, tableID{tableID}, isNodeTable{isNodeTable} {}

virtual ~TableSchema() = default;

static inline bool isReservedPropertyName(const string& propertyName) {
return propertyName == INTERNAL_ID_SUFFIX;
}
Expand Down
2 changes: 2 additions & 0 deletions src/include/parser/statement.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class Statement {
public:
explicit Statement(StatementType statementType) : statementType{statementType} {}

virtual ~Statement() = default;

inline StatementType getStatementType() const { return statementType; }

private:
Expand Down
14 changes: 7 additions & 7 deletions src/include/storage/storage_structure/storage_structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class StorageStructure {
}
}

virtual ~StorageStructure() = default;

inline VersionedFileHandle* getFileHandle() { return &fileHandle; }

protected:
Expand Down Expand Up @@ -63,7 +65,11 @@ class StorageStructure {
class BaseColumnOrList : public StorageStructure {

public:
DataTypeID getDataTypeId() const { return dataType.typeID; }
~BaseColumnOrList() override {
if (isInMemory_) {
StorageStructureUtils::unpinEachPageOfFile(fileHandle, bufferManager);
}
}

// Maps the position of element in page to its byte offset in page.
// TODO(Everyone): we should slowly get rid of this function.
Expand All @@ -76,12 +82,6 @@ class BaseColumnOrList : public StorageStructure {
DataType dataType, const size_t& elementSize, BufferManager& bufferManager,
bool hasNULLBytes, bool isInMemory, WAL* wal);

virtual ~BaseColumnOrList() {
if (isInMemory_) {
StorageStructureUtils::unpinEachPageOfFile(fileHandle, bufferManager);
}
}

void readBySequentialCopy(Transaction* transaction, const shared_ptr<ValueVector>& vector,
PageElementCursor& cursor,
const std::function<page_idx_t(page_idx_t)>& logicalToPhysicalPageMapper);
Expand Down
2 changes: 1 addition & 1 deletion src/storage/store/nodes_statistics_and_deleted_ids.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ node_offset_t NodeStatisticsAndDeletedIDs::addNode() {
node_offset_t retVal = *nodeOffsetIter;
iter->second.erase(nodeOffsetIter);
if (iter->second.empty()) {
deletedNodeOffsetsPerMorsel.erase(iter);
hasDeletedNodesPerMorsel[iter->first] = false;
deletedNodeOffsetsPerMorsel.erase(iter);
}
return retVal;
}
Expand Down

0 comments on commit d508950

Please sign in to comment.