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

Inlined BufBuilder's grow_reallocate() method consumes a lot of stack space

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 5.1.0-rc0
    • None
    • None
    • None
    • Fully Compatible
    • ALL

    Description

      When various append methods of BSONObjBuilder get inlined they all sooner or later inline grow_reallocate().

      The grow_reallocate has std::stringstream variable on a local stack (~400 bytes). All that space is allocated in the caller stack frame when the callee is inlined. 

      There is code that calls append many times and each inlined call incurs 400 bytes penalty. It quickly adds up to huge stack frames.

      Attachments

        Activity

          People

            martin.neupauer@mongodb.com Martin Neupauer
            martin.neupauer@mongodb.com Martin Neupauer
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: