Well yes - when you OBJ_RELEASE(buf), it calls free on the data blob. All you have to do is set buf->base_ptr = NULL prior to releasing.
You could also save a lot of malloc wastage by just using OBJ_CONSTRUCT/DESTRUCT for buf, though you still have to NULL the base_ptr before calling DESTRUCT > On Feb 11, 2015, at 2:57 PM, Howard Pritchard <hpprit...@gmail.com> wrote: > > Hello Folks, > > I've got a question about the opal_dss.load functionality. > > If I have a construct like > > > buf = OBJ_NEW(opal_buffer_t); > opal_dss.load(buffer, input_ptr, num_bytes_to_load); > > OBJ_RELEASE(buf); > > I'm finding that input_ptr has to have been something > returned by malloc and friends or else I get heap corruption. > > I can't do something like > > oob_allgatherv(input_ptr, bytes_from_each_rank, output_ptr); > > for (cptr = output_ptr, i = 0 ; i < pmix_size ;i ++) { > opal_dss.load(buf, cptr, bytes_from_each_rank[i]); > unpack message into dstore > cptr += bytes_from_each_rank[i]; > } > > I have to create a separate malloc'd buffer each time through the > loop and do a memcpy into the tmp buffer, then call opal_dss.load > for that particular tmp buffer. > > Is this expected behavior of opal_dss.load? Is there a way to > avoid these extra mallocs/memcopy's? > > If I don't do the above technique, the heap allocator blows up > in OBJ_RELEASE of buffer. > > Thanks, > > Howard > > > > _______________________________________________ > devel mailing list > de...@open-mpi.org > Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/devel > Link to this post: > http://www.open-mpi.org/community/lists/devel/2015/02/16968.php