2005-09-14 17:27:09 +04:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2006-08-24 20:38:08 +04:00
|
|
|
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2005-09-14 17:27:09 +04:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
*/
|
2006-08-24 20:38:08 +04:00
|
|
|
#include "ompi_config.h"
|
2006-12-17 15:26:41 +03:00
|
|
|
#include "opal/util/output.h"
|
2005-09-14 17:27:09 +04:00
|
|
|
#include "mpool_base_mem_cb.h"
|
|
|
|
#include "base.h"
|
2005-10-04 03:29:26 +04:00
|
|
|
#include "orte/util/proc_info.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "orte/mca/ns/ns_types.h"
|
2005-09-14 17:27:09 +04:00
|
|
|
|
2006-02-09 01:40:40 +03:00
|
|
|
ompi_pointer_array_t mca_mpool_base_mem_cb_array;
|
2005-09-27 06:01:21 +04:00
|
|
|
|
2005-09-14 17:27:09 +04:00
|
|
|
/*
|
|
|
|
* memory hook callback, called when memory is free'd out from under us
|
|
|
|
*/
|
2005-12-16 04:12:45 +03:00
|
|
|
void mca_mpool_base_mem_cb(void* base, size_t size, void* cbdata,
|
|
|
|
bool from_alloc)
|
2005-09-22 20:18:23 +04:00
|
|
|
{
|
2005-09-14 17:27:09 +04:00
|
|
|
mca_mpool_base_selected_module_t* current;
|
|
|
|
int rc;
|
|
|
|
opal_list_item_t* item;
|
2005-09-27 22:10:44 +04:00
|
|
|
if(size == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-09-14 17:27:09 +04:00
|
|
|
for(item = opal_list_get_first(&mca_mpool_base_modules);
|
|
|
|
item != opal_list_get_end(&mca_mpool_base_modules);
|
|
|
|
item = opal_list_get_next(item)) {
|
2006-12-17 15:26:41 +03:00
|
|
|
bool warn = true;
|
2005-09-14 17:27:09 +04:00
|
|
|
|
|
|
|
current = (mca_mpool_base_selected_module_t*) item;
|
2006-12-17 15:26:41 +03:00
|
|
|
|
|
|
|
if(current->mpool_module->mpool_release_memory != NULL) {
|
|
|
|
rc = current->mpool_module->mpool_release_memory(current->mpool_module,
|
|
|
|
base, size);
|
|
|
|
|
|
|
|
if(rc != OMPI_SUCCESS && true == warn) {
|
2007-02-01 22:27:11 +03:00
|
|
|
opal_output(0, "Memory %p:%lu cannot be freed from the "
|
2006-12-17 15:26:41 +03:00
|
|
|
"registration cache. Possible memory corruption.\n",
|
2007-02-01 22:27:11 +03:00
|
|
|
base, (unsigned long)size);
|
2006-12-17 15:26:41 +03:00
|
|
|
warn = false;
|
2005-09-14 17:27:09 +04:00
|
|
|
}
|
2005-09-27 06:01:21 +04:00
|
|
|
}
|
2005-10-04 03:29:26 +04:00
|
|
|
}
|
2005-09-14 17:27:09 +04:00
|
|
|
}
|