jemalloc/jemalloc — pull request #160 by thestinger (2014-10-31 07:45:32+00:00)
Title: add a version of rallocx taking old and used sizes

This is a cleaned up version of #152, down to ~30 additional lines of code (excluding tests). It fits in well with `sdallocx` and the implementation is now *very* simple. It's significantly less convenient than `rallocx`, but the complexity is completely acceptable in a generic string / vector implementation since it only needs to be called a few times and the code will then be reused countless times.

It's very useful in any string / vector implementation using geometric growth for reserving space and concatenation due to the slack space at the end. Sized deallocation is a nice opportunistic optimization since data structures have the information already, and the used size also provides a small improvement in general due to size class rounding.