Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-60115

Fix the Buffer Builder to Correctly use Powers of Two Allocations

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.2.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • QE 2021-10-04, QE 2021-10-18, QE 2021-11-01
    • 135

      Currently, the buffer builder tries to be friendly with the system allocators and ask for powers of two allocations: https://github.com/10gen/mongo/blob/34bb8ccdba458e000b7b0ce7b6c0c157619fcdd6/src/mongo/bson/util/builder.h#L460-L462

      However, then later down the function call chains, this power of two size is increased by a few bytes: https://github.com/10gen/mongo/blob/fcdc972cd6f64bfe710161fb3a0ffc4a5ca329d1/src/mongo/util/shared_buffer.h#L73

      In this issue, we want to fix this behaviour and make sure that the end allocated size asked from the system allocator (https://github.com/10gen/mongo/blob/47b380f03e8898f4706ff01fa2be64dfb72e0dba/src/mongo/util/allocator.cpp#L47) is a power of two.

            Assignee:
            mohammad.dashti@mongodb.com Mohammad Dashti (Inactive)
            Reporter:
            mohammad.dashti@mongodb.com Mohammad Dashti (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: