Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

From: Ralph Castain (rhc_at_[hidden])
Date: 2007-07-20 07:32:29


I guess I really don't understand this change. How is it better that I
*always* malloc a buffer that I might never use, just so I can *always*
release it - versus *only* malloc'ing and releasing a buffer when I know I
need it??

I don't really care, but this seems kinda wasteful and I would like to
understand the benefit.

Thanks
Ralph

On 7/19/07 10:06 PM, "bosilca_at_[hidden]" <bosilca_at_[hidden]> wrote:

> Author: bosilca
> Date: 2007-07-20 00:06:39 EDT (Fri, 20 Jul 2007)
> New Revision: 15533
> URL: https://svn.open-mpi.org/trac/ompi/changeset/15533
>
> Log:
> Always release the buffer (this imply the buffer has to be created
> outside the special case).
>
> Text files modified:
> trunk/orte/orted/orted_main.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> Modified: trunk/orte/orted/orted_main.c
> ==============================================================================
> --- trunk/orte/orted/orted_main.c (original)
> +++ trunk/orte/orted/orted_main.c 2007-07-20 00:06:39 EDT (Fri, 20 Jul 2007)
> @@ -391,8 +391,8 @@
> }
>
> /* if we are not a seed, prep a return buffer to say we started okay */
> + buffer = OBJ_NEW(orte_buffer_t);
> if (!orte_process_info.seed) {
> - buffer = OBJ_NEW(orte_buffer_t);
> if (ORTE_SUCCESS != (ret = orte_dss.pack(buffer, &zero, 1,
> ORTE_INT))) {
> ORTE_ERROR_LOG(ret);
> OBJ_RELEASE(buffer);
> @@ -459,6 +459,7 @@
> if (ORTE_SUCCESS != (ret = orte_ns.get_jobid_string(&jobidstring,
> orte_process_info.my_name))) {
> ORTE_ERROR_LOG(ret);
> + OBJ_RELEASE(buffer);
> return ret;
> }
>
> @@ -509,6 +510,7 @@
> ORTE_RML_NON_PERSISTENT,
> orte_daemon_recv_gate, NULL);
> if (ret != ORTE_SUCCESS && ret != ORTE_ERR_NOT_IMPLEMENTED) {
> ORTE_ERROR_LOG(ret);
> + OBJ_RELEASE(buffer);
> return ret;
> }
>
> @@ -547,8 +549,8 @@
> OBJ_RELEASE(buffer);
> return ret;
> }
> - OBJ_RELEASE(buffer); /* done with this */
> }
> + OBJ_RELEASE(buffer); /* done with this */
>
> if (orte_debug_daemons_flag) {
> opal_output(0, "%s orted: up and running - waiting for commands!",
> ORTE_NAME_PRINT(orte_process_info.my_name));
> _______________________________________________
> svn mailing list
> svn_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/svn