Skip to content
  • Kenneth Moreland's avatar
    To not reallocate to smaller buffers. · 16032a52
    Kenneth Moreland authored
    Previously, if a state buffer was needed and the existing one did not
    match the size and type exactly, the old buffer was freed and a new
    buffer was malloced. However, malloc can be slow and it is possible to
    reuse a buffer if the new one being asked for is smaller than the old
    one. Thus, change the semantics to use a previously allocated buffer if
    it is at least as big as needed. This might leave pools of data larger
    than what we need, but will reduce the overall number of malloc calls
    needed.
    16032a52