Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-596

Figure out what to do about bson_t alignment restrictions

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.2-beta0
    • Affects Version/s: None
    • Component/s: None
    • None

      We set alignment attributes for bson_t's, but we set them at 128 byte alignment (theoretically to align them for cache lines on the stack).

      The problem is that we malloc and return them that way. While malloc is guaranteed to return something as aligned as the most aligned scalar type, that isn't generally 128 byte alignment.

      That makes tools scream constantly about the misalignment. It also shows up in cases where bson_malloc has been shimmed if the memory allocater doesn't go wide enough (specifically showing up in zend_emalloc, only 8 byte alignment), which causes memcpy to screw up (it looked at the types going in and generated aggressive code assuming it could use vectorized intrinsincs, when it could not)

            Assignee:
            Unassigned Unassigned
            Reporter:
            mira.carey@mongodb.com Mira Carey
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: