In a common heap where mixes of different sizes are mixed, then of the two I would go for placing the selection in the smallest block that can place it (to avoid reducing the size of the largest block that we can allocate before we need it).
There are other ways to implement heaps that will make this issue less relevant (for example, the popular dlmalloc Doug Lea - where it combines blocks of similar sizes to improve speed and reduce overall fragmentation).
Which solution best always comes down to how the application allocates memory. If you know the application template in advance, you must beat the generic heaps in both size and speed.
source share