Skip to content
This repository was archived by the owner on Jul 14, 2022. It is now read-only.

Commit 2da84d7

Browse files
authored
Merge pull request #12 from Alpine-DAV/fix_mem_leak
fix memory leak
2 parents 22973a7 + 1e19e50 commit 2da84d7

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

src/apcomp/internal/DirectSendCompositor.cpp

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,15 @@ DirectSendCompositor::CompositeVolume(apcompdiy::mpi::communicator &diy_comm,
132132
// so we isolate them within separate blocks
133133
//
134134
{
135-
apcompdiy::Master master(diy_comm, num_threads);
135+
apcompdiy::Master master(
136+
diy_comm,
137+
num_threads,
138+
-1, 0,
139+
[](void * b){
140+
MultiImageBlock *block = reinterpret_cast<MultiImageBlock*>(b);
141+
delete block;
142+
});
143+
136144
// create an assigner with one block per rank
137145
apcompdiy::ContiguousAssigner assigner(num_blocks, num_blocks);
138146

@@ -149,7 +157,14 @@ DirectSendCompositor::CompositeVolume(apcompdiy::mpi::communicator &diy_comm,
149157
}
150158

151159
{
152-
apcompdiy::Master master(diy_comm, num_threads);
160+
apcompdiy::Master master(
161+
diy_comm,
162+
num_threads,
163+
-1, 0,
164+
[](void * b){
165+
ImageBlock<Image> *block = reinterpret_cast<ImageBlock<Image>*>(b);
166+
delete block;
167+
});
153168
apcompdiy::ContiguousAssigner assigner(num_blocks, num_blocks);
154169

155170
const int dims = 2;

src/apcomp/internal/RadixKCompositor.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,14 @@ RadixKCompositor::CompositeImpl(apcompdiy::mpi::communicator &diy_comm, ImageTyp
144144
const int num_blocks = diy_comm.size();
145145
const int magic_k = 8;
146146

147-
apcompdiy::Master master(diy_comm, num_threads);
147+
//apcompdiy::Master master(diy_comm, num_threads);
148+
apcompdiy::Master master(
149+
diy_comm, num_threads,
150+
-1, 0,
151+
[](void * b){
152+
ImageBlock<ImageType> *block = reinterpret_cast<ImageBlock<ImageType>*>(b);
153+
delete block;
154+
});
148155

149156
// create an assigner with one block per rank
150157
apcompdiy::ContiguousAssigner assigner(num_blocks, num_blocks);

0 commit comments

Comments
 (0)