Skip to content

Commit ee58edc

Browse files
authored
Merge pull request #8937 from SeyedMir/topic/osc_ucx_win_free
osc/ucx: Detach dynamic window memory when freeing a window
2 parents 9354e23 + dd7a882 commit ee58edc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ompi/mca/osc/ucx/osc_ucx_component.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,7 @@ int ompi_osc_ucx_win_detach(struct ompi_win_t *win, const void *base) {
671671
int ompi_osc_ucx_free(struct ompi_win_t *win) {
672672
ompi_osc_ucx_module_t *module = (ompi_osc_ucx_module_t*) win->w_osc_module;
673673
int ret;
674+
uint64_t i;
674675

675676
assert(module->lock_count == 0);
676677
assert(opal_list_is_empty(&module->pending_posts) == true);
@@ -687,6 +688,13 @@ int ompi_osc_ucx_free(struct ompi_win_t *win) {
687688
return ret;
688689
}
689690

691+
/* MPI_Win_free should detach any memory attached to dynamic windows */
692+
for (i = 0; i < module->state.dynamic_win_count; i++) {
693+
assert(module->local_dynamic_win_info[i].refcnt == 1);
694+
opal_common_ucx_wpmem_free(module->local_dynamic_win_info[i].mem);
695+
}
696+
module->state.dynamic_win_count = 0;
697+
690698
free(module->addrs);
691699
free(module->state_addrs);
692700

0 commit comments

Comments
 (0)