[SERVER-36243] Take advantage of c++14 sized delete facilities in tc_malloc Created: 23/Jul/18  Updated: 11/May/23  Resolved: 25/Mar/19

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

Type: Task Priority: Major - P3
Reporter: Mathias Stearn Assignee: Henrik Edin
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Duplicate
duplicates SERVER-40197 Reapply work for sized delete Closed
Problem/Incident
causes SERVER-40138 Coverity analysis defect 112182: Unsa... Closed
Related
is related to SERVER-39506 When C++20, use destroying delete whe... Closed
Sprint: Dev Tools 2019-02-25, Dev Tools 2019-03-11, Dev Tools 2019-03-25
Participants:
Linked BF Score: 16

 Description   

Google reported substantial performance improvement by adopting sized delete.

 

Tasks:

  • Ensure we are building tcmalloc in a way that enables sized delete
  • Ensure we are passing the c++ flags to tell the compiler to use it automatically where it can
  • Make sure all of the Document/Value allocations (including RCString) can use sized delete
    • May need to make second argument to RCString::operator new() a different type (currently size_t)
  • Find the best way to expose a sized free equivalent for code using malloc/relloc/free
    • Teach SharedBuffer to used sized free
    • Teach WiredTiger to use sized free for any allocations that know their own size (WT_UPDATE already identified as an important case)


 Comments   
Comment by Andrew Morrow (Inactive) [ 25/Mar/19 ]

Re-closing as a duplicate of SERVER-40197. This work landed for 4.1.9 but was reverted after 4.1.9.

Comment by Githook User [ 18/Mar/19 ]

Author:

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

Message: Revert "SERVER-36243 Use sized deallocation."

This reverts commit afe082642124dbda2367cb51c3d748873df9bf7b.
Branch: master
https://github.com/mongodb/mongo/commit/5ab83a702659235ea138c62fca3e608bb1def8cf

Comment by Githook User [ 12/Mar/19 ]

Author:

{'name': 'Henrik Edin', 'email': 'henrik.edin@mongodb.com', 'username': 'henrikedin'}

Message: SERVER-36243 Use sized deallocation.

Added mongoFree to be used when allocating memory with mongoMalloc.
It has an overload taking size utilizing tc_free_sized if built with tcmalloc.
Branch: master
https://github.com/mongodb/mongo/commit/afe082642124dbda2367cb51c3d748873df9bf7b

Comment by Bruce Lucas (Inactive) [ 08/Feb/19 ]

We should also check whether this plays well with the built-in heap profiler (util/heap_profiler.cpp). I expect it should because the heap profiler hooks in at a lower level of tcmalloc, but it's worth checking to be sure.

Comment by Andrew Morrow (Inactive) [ 25/Jan/19 ]

Also need to remember to pass in the --enable-sized-delete or windows equivalent when configuring (and investigate what is needed in the toolchain flags as well (-fsized-deallocation or /Zc:sizedDealloc.

Comment by Andrew Morrow (Inactive) [ 25/Jan/19 ]

This should also include rebuilding all configs with v3 toolchain.

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