Commit 2134290
committed
Add fast path for growing realloc()
When realloc() needs a larger size, we can check if the next block is
free and adjacent. If the combined size of the current and next block
is sufficient, merge them into a single block and split it to the
desired size.
This fast path avoids allocating a new block and copying data, and
selective coalescing is triggered only when fragmentation exceeds the
threshold, improving performance for growing realloc() calls.1 parent a73aa24 commit 2134290
1 file changed
+17
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
291 | 308 | | |
292 | 309 | | |
293 | 310 | | |
| |||
0 commit comments