[go: nahoru, domu]

Skip to content

Commit

Permalink
Serializer: always Purge() on deconstruct.
Browse files Browse the repository at this point in the history
Signed-off-by: Henner Zeller <h.zeller@acm.org>
  • Loading branch information
hzeller committed Jun 11, 2022
1 parent 79ecd7a commit 685e13b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions templates/Serializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ std::map<std::string, unsigned long> Serializer::ObjectStats() const {
return stats;
}

Serializer::~Serializer() {
Purge();
}

void Serializer::Purge() {
allIds_.clear();
anyVectMaker.Purge();
Expand Down
2 changes: 2 additions & 0 deletions templates/Serializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ class Serializer {
Serializer() : incrId_(0), objId_(0), errorHandler(DefaultErrorHandler) {
symbolMaker.Make("");
}
~Serializer();

void Save(const std::string& file);
void Purge();
void SetErrorHandler(ErrorHandler handler) { errorHandler = handler; }
Expand Down
1 change: 0 additions & 1 deletion tests/garbage_collect_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,4 @@ TEST(GarbageCollectTest, NoLeakExpectation) {
for (vpiHandle design : restoredDesigns) {
vpi_release_handle(design);
}
serializer.Purge();
}

0 comments on commit 685e13b

Please sign in to comment.