[llvm-commits] [llvm] r173349 - in /llvm/trunk/tools/lli: RecordingMemoryManager.cpp RecordingMemoryManager.h
NAKAMURA Takumi
geek4civic at gmail.com
Thu Jan 24 06:19:58 PST 2013
Andy, please reconfirm it, and I'd be happy if you considered if
sections would be destructed in the MemoryManager's destructor.
...Takumi
2013/1/24 NAKAMURA Takumi <geek4civic at gmail.com>:
> Author: chapuni
> Date: Thu Jan 24 08:12:12 2013
> New Revision: 173349
>
> URL: http://llvm.org/viewvc/llvm-project?rev=173349&view=rev
> Log:
> lli/RecordingMemoryManager: Free allocated sections in the destructor to satisfy --vg-leak!
>
> FIXME: It could be generalized in MemoryManager.
>
> Modified:
> llvm/trunk/tools/lli/RecordingMemoryManager.cpp
> llvm/trunk/tools/lli/RecordingMemoryManager.h
>
> Modified: llvm/trunk/tools/lli/RecordingMemoryManager.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/RecordingMemoryManager.cpp?rev=173349&r1=173348&r2=173349&view=diff
> ==============================================================================
> --- llvm/trunk/tools/lli/RecordingMemoryManager.cpp (original)
> +++ llvm/trunk/tools/lli/RecordingMemoryManager.cpp Thu Jan 24 08:12:12 2013
> @@ -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.
>
> Modified: llvm/trunk/tools/lli/RecordingMemoryManager.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/RecordingMemoryManager.h?rev=173349&r1=173348&r2=173349&view=diff
> ==============================================================================
> --- llvm/trunk/tools/lli/RecordingMemoryManager.h (original)
> +++ llvm/trunk/tools/lli/RecordingMemoryManager.h Thu Jan 24 08:12:12 2013
> @@ -33,7 +33,7 @@
>
> public:
> RecordingMemoryManager() {}
> - virtual ~RecordingMemoryManager() {}
> + virtual ~RecordingMemoryManager();
>
> typedef SmallVectorImpl<Allocation>::const_iterator const_data_iterator;
> typedef SmallVectorImpl<Allocation>::const_iterator const_code_iterator;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list