[SERVER-13544] Backport upstream patches to gperftools to support tcmalloc in C++11 Created: 10/Apr/14  Updated: 11/Jul/16  Resolved: 14/Apr/14

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 2.7.0

Type: Improvement Priority: Major - P3
Reporter: Andy Schwerin Assignee: Andrew Morrow (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-27353 Remove --allocator=system from all sc... Closed
Participants:

 Description   

The vendored version of gperftools does not support C++11, nor does the currently released version of gperftools (2.1). This ticket is to apply the upstream gperftools patches needed for C++11 support to the vendored version of the library, as a stop-gap until gperftools 2.2 is released.



 Comments   
Comment by Githook User [ 14/Apr/14 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}

Message: SERVER-13544 Enable gperftools for C++11 builds

The following change was backported:
https://code.google.com/p/gperftools/source/detail?r=18fbc316eebea9db2d7ec41e161c0a3fbb09fa42

Another change we wanted was:
https://code.google.com/p/gperftools/source/detail?r=6287bbbbad8730712cfd1ee28ecc0648cbaa9f94#

However, since that patch must hit every PR/SC instance and the code has evolved from that point
we instead just ran the following two scripts over the gperftools source tree:

find . -type f | xargs egrep -l '"PR\w+"' | xargs perl -pi -e 's|"PR(\w+)"|" PR\1 "|g'
find . -type f | xargs egrep -l '"SC\w+"' | xargs perl -pi -e 's|"SC(\w+)"|" SC\1 "|g'

and then manually fixing up the one reference to GPRIuPTHREAD, which achieved the same result.

Finally, remove the logic preventing mixture of C++11 and gperftools from the build system.
Branch: master
https://github.com/mongodb/mongo/commit/2c01237bc054bb4b32226545cba9782b5d87bcf2

Comment by Andrew Morrow (Inactive) [ 12/Apr/14 ]

Looking at the relevant changes, I don't think we can just cherry-pick the format string change because the change needs to be systemic and hit all SC/PR usages:

https://code.google.com/p/gperftools/source/detail?r=6287bbbbad8730712cfd1ee28ecc0648cbaa9f94#

I think we should just run the following over the tcmalloc code in our tree:

find . -type f | xargs egrep -l '"PR\w+"' | xargs perl -pi -e 's|"PR(\w+)"|" PR\1 "|g'

find . -type f | xargs egrep -l '"SC\w+"' | xargs perl -pi -e 's|"SC(\w+)"|" SC\1 "|g'

The other change we want is trivial: 18fbc316eebea9db2d7ec41e161c0a3fbb09fa42 and we can just take.

Hopefully they will release a gperftools-2.2 during 2.8 dev and we can just bump to that but in the meantime lets make these easy change.

Generated at Thu Feb 08 03:32:04 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.