Boost logo

Boost Users :

Subject: Re: [Boost-users] [MPI] Code example leaks memory
From: Brian Wood (woodbrian77_at_[hidden])
Date: 2010-03-27 17:13:16


> Hi all,
>
> the code example given at:
http://www.boost.org/doc/libs/1_41_0/doc/html/mpi/tutorial.html
> leaks memory as reported by Valgrind 3.5.0

There are several examples/main()'s on that page. I'm not sure
which one you're talking about.

I think the following paragraph from that page under the "User-defined data
types"
heading could be improved.

"The redundant copy elimination optimization can only be applied when the
shape of the data type is completely fixed. Variable-length types (e.g.,
strings, linked lists) and types that store pointers cannot use the
optimiation, but Boost.MPI will be unable to detect this error at compile
time. Attempting to perform this optimization when it is not correct will
likely result in segmentation faults and other strange program behavior."

I suggest the following:
The redundant copy elimination optimization should only be applied when the
shape of the data type is completely fixed. When a type has variable-length
members (e.g., strings, linked lists) or pointers this optimization
shouldn't be used as Boost.MPI will be unable to detect this error at
compile time. Attempting to perform this optimization when it is not correct
will likely result in segmentation faults and other strange program
behavior.

I changed "can" to "should" in the first sentence and reworked the second
sentence, including correcting the spelling of optimization.

Brian Wood
Ebenezer Enterprises
http://webEbenezer.net
(651) 251-9384

"Then Samuel took a stone, and set it between Mizpeh and
Shen, and called the name of it Ebenezer, saying, Till now
has the L-RD helped us."



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net