@@ -97,8 +97,11 @@ recvMsgIntoInternalBuffer(MPI_Status status, MPI_Comm comm)
9797 MPI_Type_size (MPI_BYTE, &size);
9898 JASSERT (size == 1 );
9999 void *buf = JALLOC_HELPER_MALLOC (count);
100- MPI_Recv (buf, count, MPI_BYTE, status.MPI_SOURCE , status.MPI_TAG ,
100+ int rc = MPI_Recv (buf, count, MPI_BYTE, status.MPI_SOURCE , status.MPI_TAG ,
101101 comm, MPI_STATUS_IGNORE);
102+ if (rc != MPI_SUCCESS) {
103+ fprintf (stderr, " MPI_Recv failed\n " );
104+ }
102105
103106 mpi_message_t *message = (mpi_message_t *)JALLOC_HELPER_MALLOC (sizeof (mpi_message_t ));
104107 message->buf = buf;
@@ -116,7 +119,7 @@ recvMsgIntoInternalBuffer(MPI_Status status, MPI_Comm comm)
116119
117120// Go through each MPI_Irecv in the g_async_calls map and try to complete
118121// the MPI_Irecv before checkpointing.
119- int
122+ static int
120123completePendingIrecvs ()
121124{
122125 int bytesReceived = 0 ;
@@ -135,6 +138,7 @@ completePendingIrecvs()
135138 call->comm );
136139 g_recvBytesByRank[worldRank] += call->count * size;
137140 bytesReceived += call->count * size;
141+ JALLOC_HELPER_FREE (call);
138142 it = g_async_calls.erase (it);
139143 } else {
140144 /* We update the iterator even if the MPI_Test fails.
@@ -162,7 +166,7 @@ completePendingIrecvs()
162166 return bytesReceived;
163167}
164168
165- int
169+ static int
166170recvFromAllComms ()
167171{
168172 int bytesReceived = 0 ;
@@ -190,17 +194,16 @@ recvFromAllComms()
190194 return bytesReceived;
191195}
192196
193- void
197+ static void
194198removePendingSendRequests ()
195199{
196200 dmtcp::map<MPI_Request, mpi_async_call_t *>::iterator it;
197201 for (it = g_async_calls.begin (); it != g_async_calls.end ();) {
198202 MPI_Request request = it->first ;
199203 mpi_async_call_t *call = it->second ;
200- int flag = 0 ;
201204 if (call->type == ISEND_REQUEST) {
202205 UPDATE_REQUEST_MAP (request, MPI_REQUEST_NULL);
203- // FIXME: We should free ` call' to avoid memory leak
206+ JALLOC_HELPER_FREE ( call);
204207 it = g_async_calls.erase (it);
205208 } else {
206209 it++;
0 commit comments