aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2013-01-24 14:12:12 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2013-01-24 14:12:12 +0000
commit5bac013d617ab3c03cdc9ee034e5efbb03adf3de (patch)
treeae1fc65c4ddfbacacac9850ab5fb838f03c6b3c5 /tools
parenteacef325c6412820a377fe4f853eb9c7c23db9ee (diff)
downloadexternal_llvm-5bac013d617ab3c03cdc9ee034e5efbb03adf3de.zip
external_llvm-5bac013d617ab3c03cdc9ee034e5efbb03adf3de.tar.gz
external_llvm-5bac013d617ab3c03cdc9ee034e5efbb03adf3de.tar.bz2
lli/RecordingMemoryManager: Free allocated sections in the destructor to satisfy --vg-leak!
FIXME: It could be generalized in MemoryManager. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173349 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/lli/RecordingMemoryManager.cpp11
-rw-r--r--tools/lli/RecordingMemoryManager.h2
2 files changed, 12 insertions, 1 deletions
diff --git a/tools/lli/RecordingMemoryManager.cpp b/tools/lli/RecordingMemoryManager.cpp
index 75cb978..d9715e1 100644
--- a/tools/lli/RecordingMemoryManager.cpp
+++ b/tools/lli/RecordingMemoryManager.cpp
@@ -15,6 +15,17 @@
#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.
diff --git a/tools/lli/RecordingMemoryManager.h b/tools/lli/RecordingMemoryManager.h
index 20fd0c2..85bf4e1 100644
--- a/tools/lli/RecordingMemoryManager.h
+++ b/tools/lli/RecordingMemoryManager.h
@@ -33,7 +33,7 @@ private:
public:
RecordingMemoryManager() {}
- virtual ~RecordingMemoryManager() {}
+ virtual ~RecordingMemoryManager();
typedef SmallVectorImpl<Allocation>::const_iterator const_data_iterator;
typedef SmallVectorImpl<Allocation>::const_iterator const_code_iterator;