static int mca_rcache_base_close(void) { opal_list_item_t *item; mca_rcache_base_selected_module_t *sm; /* Finalize all the rcache components and free their list items */ while (NULL != (item = opal_list_remove_first(&mca_rcache_base_modules))) { sm = (mca_rcache_base_selected_module_t *) item; /* Blatently ignore the return code (what would we do to recover, anyway? This component is going away, so errors don't matter anymore). Note that it's legal for the module to have NULL for the finalize function. */ if (NULL != sm->rcache_module->rcache_finalize) { sm->rcache_module->rcache_finalize(sm->rcache_module); } OBJ_RELEASE(sm); } /* deregister memory free callback */ if (mca_rcache_base_used_mem_hooks) { opal_mem_hooks_unregister_release(mca_rcache_base_mem_cb); } /* All done */ /* Close all remaining available components */ return mca_base_framework_components_close(&opal_rcache_base_framework, NULL); }
static int hcoll_close(void) { int rc; mca_coll_hcoll_component_t *cm; cm = &mca_coll_hcoll_component; if (false == cm->libhcoll_initialized) { return OMPI_SUCCESS; } if (cm->using_mem_hooks) { opal_mem_hooks_unregister_release(mca_coll_hcoll_mem_release_cb); } #if HCOLL_API >= HCOLL_VERSION(3,2) hcoll_free_init_opts(cm->init_opts); #endif HCOL_VERBOSE(5,"HCOLL FINALIZE"); rc = hcoll_finalize(); opal_progress_unregister(mca_coll_hcoll_progress); if (HCOLL_SUCCESS != rc){ HCOL_VERBOSE(1,"Hcol library finalize failed"); return OMPI_ERROR; } return OMPI_SUCCESS; }
int ompi_mtl_mxm_finalize(struct mca_mtl_base_module_t* mtl) { #if MXM_API >= MXM_VERSION(2,0) if (ompi_mtl_mxm.using_mem_hooks) { opal_mem_hooks_unregister_release(ompi_mtl_mxm_mem_release_cb); } #endif opal_progress_unregister(ompi_mtl_mxm_progress); mxm_ep_destroy(ompi_mtl_mxm.ep); return OMPI_SUCCESS; }
static int mca_pml_ucx_component_close(void) { int rc; rc = mca_pml_ucx_close(); if (rc != 0) { return rc; } opal_mem_hooks_unregister_release(mca_pml_ucx_mem_release_cb); opal_output_close(ompi_pml_ucx.output); return 0; }
int mca_mpool_base_close(void) { opal_list_item_t *item; mca_mpool_base_selected_module_t *sm; int32_t modules_length; /* Need the initial length in order to know if some of the initializations * are done in the open function. */ modules_length = opal_list_get_size(&mca_mpool_base_modules); /* Finalize all the mpool components and free their list items */ for (item = opal_list_remove_first(&mca_mpool_base_modules); NULL != item; item = opal_list_remove_first(&mca_mpool_base_modules)) { sm = (mca_mpool_base_selected_module_t *) item; /* Blatently ignore the return code (what would we do to recover, anyway? This component is going away, so errors don't matter anymore). Note that it's legal for the module to have NULL for the finalize function. */ if (NULL != sm->mpool_module->mpool_finalize) { sm->mpool_module->mpool_finalize(sm->mpool_module); } OBJ_RELEASE(sm); } /* Close all remaining available components (may be one if this is a OMPI RTE program, or [possibly] multiple if this is ompi_info) */ mca_base_components_close(mca_mpool_base_output, &mca_mpool_base_components, NULL); /* deregister memory free callback */ if( (modules_length > 0) && mca_mpool_base_used_mem_hooks && 0 != (OPAL_MEMORY_FREE_SUPPORT & opal_mem_hooks_support_level())) { opal_mem_hooks_unregister_release(mca_mpool_base_mem_cb); OBJ_DESTRUCT(&mca_mpool_base_mem_cb_array); } /* All done */ return OMPI_SUCCESS; }
static int alloc_free_test(void) { void *foo, *bar; int retval; retval = opal_mem_hooks_register_release(release_callback, NULL); retval |= opal_mem_hooks_register_alloc(alloc_callback, NULL); if (retval != OMPI_SUCCESS) { printf("handler registration failed\n"); return retval; } /* make some big malloc that should always trip a release on free */ printf(" - malloc big buffer\n"); counter = 0; foo = malloc(bigsize); assert(counter >= 1); printf(" - free of big buffer\n"); counter = 1; free(foo); assert(counter == 0); /* check mmap / munmap */ printf(" - mmap of buffer\n"); counter = 0; bar = mmap(NULL, 4096, PROT_READ, MAP_ANON, -1, 0); if (opal_mem_hooks_support_level() & OPAL_MEMORY_MMAP_SUPPORT) { assert(counter >= 1); } printf(" - munmap of buffer\n"); /* mmap might call malloc internally, so do this or we might appear to leak memory */ counter = 1; munmap(NULL, 0); assert(counter == 0); retval = opal_mem_hooks_unregister_release(release_callback); retval |= opal_mem_hooks_unregister_alloc(alloc_callback); return OPAL_SUCCESS; }
int mca_pml_yalla_cleanup(void) { PML_YALLA_VERBOSE(1, "mca_pml_yalla_cleanup"); opal_progress_unregister(mca_pml_yalla_progress); OBJ_DESTRUCT(&ompi_pml_yalla.convs); OBJ_DESTRUCT(&ompi_pml_yalla.recv_reqs); OBJ_DESTRUCT(&ompi_pml_yalla.bsend_reqs); OBJ_DESTRUCT(&ompi_pml_yalla.send_reqs); if (ompi_pml_yalla.mxm_ep) { mxm_ep_destroy(ompi_pml_yalla.mxm_ep); ompi_pml_yalla.mxm_ep = NULL; } if (ompi_pml_yalla.using_mem_hooks) { opal_mem_hooks_unregister_release(mca_pml_yalla_mem_release_cb); } return OMPI_SUCCESS; }