Parcourir la source

[2850] Looks like flush() finalizes base_sgmt_, so we free before that

Mukund Sivaraman il y a 12 ans
Parent
commit
3c98ade56f
1 fichiers modifiés avec 1 ajouts et 4 suppressions
  1. 1 4
      src/lib/util/memory_segment_mapped.cc

+ 1 - 4
src/lib/util/memory_segment_mapped.cc

@@ -137,10 +137,6 @@ struct MemorySegmentMapped::Impl {
         reserveMemory();
     }
 
-    ~Impl() {
-        freeReservedMemory();
-    }
-
     void reserveMemory() {
         if (!read_only_) {
             // Reserve a named address for use during setNamedAddress().
@@ -261,6 +257,7 @@ MemorySegmentMapped::MemorySegmentMapped(const std::string& filename,
 
 MemorySegmentMapped::~MemorySegmentMapped() {
     if (impl_->base_sgmt_ && !impl_->read_only_) {
+        impl_->freeReservedMemory();
         impl_->base_sgmt_->flush(); // note: this is exception free
     }
     delete impl_;