Commit a73aa24
committed
Add fast path for shrinking realloc()
When realloc() is called with a smaller size than the current block,
we can avoid allocating a new block and copying data. Instead, split
the existing block into two smaller blocks using the split_block()
helper.
This fast path improves performance for shrinking realloc() calls and
triggers selective coalescing only when fragmentation exceeds the
threshold.1 parent b0fbaf7 commit a73aa24
1 file changed
+10
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
281 | 291 | | |
282 | 292 | | |
283 | 293 | | |
| |||
0 commit comments