lli/RecordingMemoryManager: Free allocated sections in the destructor to satisfy...
[oota-llvm.git] / tools / lli / RecordingMemoryManager.cpp
index 75cb978130629afc18e9d070398690c7f1f5742a..d9715e1a038c8b5aa4d0d6b8bcf1d5e72550bf27 100644 (file)
 #include "RecordingMemoryManager.h"
 using namespace llvm;
 
+RecordingMemoryManager::~RecordingMemoryManager() {
+  for (SmallVectorImpl<Allocation>::iterator
+         I = AllocatedCodeMem.begin(), E = AllocatedCodeMem.end();
+       I != E; ++I)
+    free(I->first.base());
+  for (SmallVectorImpl<Allocation>::iterator
+         I = AllocatedDataMem.begin(), E = AllocatedDataMem.end();
+       I != E; ++I)
+    free(I->first.base());
+}
+
 uint8_t *RecordingMemoryManager::
 allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID) {
   // The recording memory manager is just a local copy of the remote target.