From 397aa809fd1cb3901b0bf74de3580282e757fddb Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Mon, 29 May 2017 14:34:10 +0200 Subject: [PATCH] plug a huge memleak in regular communications --- src/kernel/activity/CommImpl.cpp | 2 +- src/simix/smx_network.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/kernel/activity/CommImpl.cpp b/src/kernel/activity/CommImpl.cpp index aebf0556c2..58182eaf3f 100644 --- a/src/kernel/activity/CommImpl.cpp +++ b/src/kernel/activity/CommImpl.cpp @@ -18,7 +18,7 @@ simgrid::kernel::activity::CommImpl::CommImpl(e_smx_comm_type_t _type) : type(_t src_data = nullptr; dst_data = nullptr; intrusive_ptr_add_ref(this); - XBT_DEBUG("Create communicate synchro %p", this); + XBT_DEBUG("Create comm activity %p", this); } simgrid::kernel::activity::CommImpl::~CommImpl() diff --git a/src/simix/smx_network.cpp b/src/simix/smx_network.cpp index f1d9614bb5..9ac82e3064 100644 --- a/src/simix/smx_network.cpp +++ b/src/simix/smx_network.cpp @@ -202,7 +202,7 @@ smx_activity_t SIMIX_comm_irecv(smx_actor_t dst_proc, smx_mailbox_t mbox, void * other_comm = this_synchro; mbox->push(this_synchro); } else { - if(other_comm->surf_comm && other_comm->remains() < 1e-12) { + if (other_comm->surf_comm && other_comm->remains() < 1e-12) { XBT_DEBUG("comm %p has been already sent, and is finished, destroy it",other_comm); other_comm->state = SIMIX_DONE; other_comm->type = SIMIX_COMM_DONE; @@ -226,11 +226,14 @@ smx_activity_t SIMIX_comm_irecv(smx_actor_t dst_proc, smx_mailbox_t mbox, void * other_comm = this_synchro; mbox->push(this_synchro); } else { - SIMIX_comm_unref(this_synchro); + XBT_DEBUG("Match my %p with the existing %p", this_synchro, other_comm); + other_comm = static_cast(other_comm); other_comm->state = SIMIX_READY; other_comm->type = SIMIX_COMM_READY; + SIMIX_comm_unref(this_synchro); + SIMIX_comm_unref(this_synchro); } dst_proc->comms.push_back(other_comm); } -- 2.20.1