lli/RecordingMemoryManager: Free allocated sections in the destructor to satisfy --vg-leak!

FIXME: It could be generalized in MemoryManager.
llvm-svn: 173349
This commit is contained in:
NAKAMURA Takumi 2013-01-24 14:12:12 +00:00
parent 4e3b9802bd
commit a05a339c96
2 changed files with 12 additions and 1 deletions

View File

@ -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.

View File

@ -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;