• Evan Wallace's avatar
    Round up allocation size to avoid misalignment (issue #226) · 47aab782
    Evan Wallace authored
    Before this change, requesting a large initial allocation could cause the
    backing store to grow to an unaligned size. Since memory inside vector_downward
    is relative to the end of the buffer, this then caused all memory in the buffer
    to be misaligned and also misaligns any further loads and stores. Misaligned
    loads and stores are undefined behavior and don't work in environments such as
    emscripten (a JavaScript to C++ compiler).
    47aab782
flatbuffers.h 38.9 KB