1
1

* more memory leak fixes - mainly string params not being freed at end of

time
* Added code to free dps structures at shutdown

This commit was SVN r7043.
Этот коммит содержится в:
Brian Barrett 2005-08-26 02:08:23 +00:00
родитель 77dafc7826
Коммит 17c1bb355e
9 изменённых файлов: 79 добавлений и 25 удалений

Просмотреть файл

@ -109,6 +109,7 @@ extern "C" {
* Internal struct used for holding registered dps functions
*/
struct orte_dps_type_info_t {
opal_object_t super;
/* type identifier */
orte_data_type_t odti_type;
/** Debugging string name */
@ -122,6 +123,7 @@ struct orte_dps_type_info_t {
* Convenience typedef
*/
typedef struct orte_dps_type_info_t orte_dps_type_info_t;
OBJ_CLASS_DECLARATION(orte_dps_type_info_t);
/*
* globals needed within dps

Просмотреть файл

@ -50,7 +50,7 @@ int orte_dps_register(orte_dps_pack_fn_t pack_fn,
}
/* Add a new entry to the table */
info = (orte_dps_type_info_t*)malloc(sizeof(orte_dps_type_info_t));
info = (orte_dps_type_info_t*) OBJ_NEW(orte_dps_type_info_t);
if (NULL == info) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;

Просмотреть файл

@ -74,6 +74,23 @@ OBJ_CLASS_INSTANCE(orte_buffer_t,
orte_buffer_destruct);
static void orte_dps_type_info_construct(orte_dps_type_info_t *obj)
{
obj->odti_name = NULL;
}
static void orte_dps_type_info_destruct(orte_dps_type_info_t *obj)
{
if (NULL != obj->odti_name) {
free(obj->odti_name);
}
}
OBJ_CLASS_INSTANCE(orte_dps_type_info_t, opal_object_t,
orte_dps_type_info_construct,
orte_dps_type_info_destruct);
int orte_dps_open(void)
{
char *enviro_val;
@ -243,7 +260,18 @@ int orte_dps_open(void)
int orte_dps_close(void)
{
size_t i;
orte_dps_initialized = false;
for (i = 0 ; i < orte_pointer_array_get_size(orte_dps_types) ; ++i) {
orte_dps_type_info_t *info = orte_pointer_array_get_item(orte_dps_types, i);
if (NULL != info) {
OBJ_RELEASE(info);
}
}
OBJ_RELEASE(orte_dps_types);
return ORTE_SUCCESS;
}

Просмотреть файл

@ -155,6 +155,7 @@ int orte_pls_rsh_component_open(void)
&param);
mca_pls_rsh_component.argv = opal_argv_split(param, ' ');
mca_pls_rsh_component.argc = opal_argv_count(mca_pls_rsh_component.argv);
if (NULL != param) free(param);
if (mca_pls_rsh_component.argc > 0) {
/* If the agent is ssh, and debug was not selected, then
automatically add "-x" */
@ -207,6 +208,9 @@ int orte_pls_rsh_component_close(void)
/* cleanup state */
OBJ_DESTRUCT(&mca_pls_rsh_component.lock);
OBJ_DESTRUCT(&mca_pls_rsh_component.cond);
if (NULL != mca_pls_rsh_component.orted) {
free(mca_pls_rsh_component.orted);
}
if(NULL != mca_pls_rsh_component.argv)
opal_argv_free(mca_pls_rsh_component.argv);
if(NULL != mca_pls_rsh_component.path)

Просмотреть файл

@ -40,6 +40,7 @@ const char *mca_pls_slurm_component_version_string =
* Local functions
*/
static int pls_slurm_open(void);
static int pls_slurm_close(void);
static struct orte_pls_base_module_1_0_0_t *pls_slurm_init(int *priority);
@ -70,7 +71,7 @@ orte_pls_slurm_component_t mca_pls_slurm_component = {
/* Component open and close functions */
pls_slurm_open,
NULL
pls_slurm_close
},
/* Next the MCA v1.0.0 component meta data */
@ -127,3 +128,13 @@ static struct orte_pls_base_module_1_0_0_t *pls_slurm_init(int *priority)
return NULL;
}
static int pls_slurm_close(void)
{
if (NULL != mca_pls_slurm_component.orted) {
free(mca_pls_slurm_component.orted);
}
return ORTE_SUCCESS;
}

Просмотреть файл

@ -76,7 +76,7 @@ static int orte_ras_host_param_register_int(
}
static char *orte_rmaps_round_robin_param_register_string(
static char *orte_ras_host_param_register_string(
const char * a, const char *b, const char *c,
char *default_value)
{
@ -98,7 +98,7 @@ static int orte_ras_host_open(void)
orte_ras_host_param_register_int("priority", 1);
/* JMS To be changed post-beta to LAM's C/N command line notation */
mca_ras_host_component.schedule_policy =
orte_rmaps_round_robin_param_register_string("ras", "base", "schedule_policy", "slot");
orte_ras_host_param_register_string("ras", "base", "schedule_policy", "slot");
return ORTE_SUCCESS;
}
@ -115,6 +115,10 @@ static orte_ras_base_module_t *orte_ras_host_init(int* priority)
static int orte_ras_host_close(void)
{
if (NULL != mca_ras_host_component.schedule_policy) {
free(mca_ras_host_component.schedule_policy);
}
return ORTE_SUCCESS;
}

Просмотреть файл

@ -117,6 +117,10 @@ orte_rmaps_round_robin_init(int *priority)
static int orte_rmaps_round_robin_close(void)
{
if (NULL != mca_rmaps_round_robin_component.schedule_policy) {
free(mca_rmaps_round_robin_component.schedule_policy);
}
return ORTE_SUCCESS;
}

Просмотреть файл

@ -7,7 +7,8 @@
#include <stdio.h>
#include "support.h"
#include "class/orte_bitmap.h"
#include "orte/class/orte_bitmap.h"
#include "opal/runtime/opal.h"
#define STANDALONE
@ -51,6 +52,8 @@ int main(int argc, char *argv[])
orte_bitmap_t bm;
int err;
opal_init();
/* Perform overall test initialization */
test_init("orte_bitmap_t");
@ -62,6 +65,8 @@ int main(int argc, char *argv[])
#endif
/* Initialize bitmap */
OBJ_CONSTRUCT(&bm, orte_bitmap_t);
PRINT_VALID_ERR;
err = orte_bitmap_init(NULL, 2);
if (err == ORTE_ERR_BAD_PARAM) {
@ -97,6 +102,8 @@ int main(int argc, char *argv[])
fprintf(error_out, "\nTesting bitmap find_size... \n");
test_bitmap_find_size(&bm);
OBJ_DESTRUCT(&bm);
fprintf(error_out, "\n~~~~~~ Testing complete ~~~~~~ \n\n");
test_finalize();
@ -104,6 +111,8 @@ int main(int argc, char *argv[])
fclose(error_out);
#endif
opal_finalize();
return 0;
}

Просмотреть файл

@ -46,6 +46,7 @@
#include "orte/mca/gpr/base/base.h"
#include "orte/mca/rmgr/base/base.h"
#include "orte/mca/soh/base/base.h"
#include "opal/runtime/opal.h"
#define NUM_ITERS 3
#define NUM_ELEMS 10
@ -74,13 +75,11 @@ int main (int argc, char* argv[])
{
int ret;
opal_init();
test_init("orte_dps");
test_out = stderr;
/* Open up the output streams */
if (!opal_output_init()) {
return OMPI_ERROR;
}
/*
* If threads are supported - assume that we are using threads -
@ -88,14 +87,6 @@ int main (int argc, char* argv[])
*/
opal_set_using_threads(OMPI_HAVE_THREAD_SUPPORT);
/* For malloc debugging */
opal_malloc_init();
/* Ensure the system_info structure is instantiated and initialized */
if (ORTE_SUCCESS != (ret = orte_sys_info())) {
return ret;
}
/* Ensure the process info structure is instantiated and initialized */
if (ORTE_SUCCESS != (ret = orte_proc_info())) {
return ret;
@ -107,14 +98,6 @@ int main (int argc, char* argv[])
orte_process_info.my_name->jobid = 0;
orte_process_info.my_name->vpid = 0;
/* startup the MCA */
if (OMPI_SUCCESS == mca_base_open()) {
fprintf(test_out, "MCA started\n");
} else {
fprintf(test_out, "MCA could not start\n");
exit (1);
}
/* open the dps */
if (ORTE_SUCCESS == orte_dps_open()) {
fprintf(test_out, "DPS started\n");
@ -295,6 +278,15 @@ int main (int argc, char* argv[])
ret = test_finalize();
fclose(test_out);
orte_soh_base_close();
orte_rmgr_base_close();
orte_gpr_base_close();
orte_ns_base_close();
orte_dps_close();
opal_finalize();
return ret;
}