On Wed, Feb 20, 2008 at 10:26 PM, Julian Seward <[EMAIL PROTECTED]> wrote:
> Typically only a small fraction of the memory in a program is shared;
> most is unshared. It might be easier to turn it upside down, so the
> tool is notified of areas which may be shared. Hmm. Not sure if
> that is a good idea. It would give stronger checking but would
> require exhaustively annotating all locations which might become
> shared.
In my previous e-mail I forgot to mention that exhaustively annotating
all shared locations would require to modify standard libraries.
Consider e.g. the std::string class defined in the ANSI C++ standard.
The language standard allows the standard library implementor to
choose between an implementation based on reference counting or an
implementation that copies the contents of a string in the copy
constructor. Consider now the following typical implementation of an
accessor function:
class PersonInformation;
std::string PersonInformation::GetName()
{ /* lock mutex */; std::string result = m_Name; /* unlock mutex */;
return result; }
If the member function GetName() is called from another thread than
the thread in which m_Name was initialized, the data inside the m_Name
object will or will not be shared over threads. This depends on the
implementation of the std::string class (reference counting or
copying). Or: any annotations with regard to sharing should be added
inside the std::string class implementation. And the implementation of
this class is inside a library header, which we do not want to modify.
Bart.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Valgrind-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-developers