News for hackers. Stuff that matters.
Re:Std::string half of all allocations in the Chrome browser... by humanrebar on Friday December 05, 2014 @12:16PM (#8705557)
Yes, COW mutable strings is problematic. It makes more sense to have immutable COW strings, so locking for access isn't a concern. Of course, C++ doesn't have proper immutable data, so a carefully designed interface would be needed.

That's not to say it's a perfect solution.

As far as incorrect reference counts, that's a quality of implementation issue. In a truly multithreaded environment, you'd use locks or atomics to ensure thread safety.

In other words, if you have a nice wrapper around a shared_ptr<vector<char const> const>, I don't think most of what you wrote above really applies anymore. But, again, it would be even better if C++ had a proper concept of immutability.

There are no comments on this comment yet.