forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitc22dea8
committed
Improve memory management code to avoid inefficient behavior when a context
has a small maxBlockSize: the maximum request size that we will treat as a"chunk" needs to be limited to fit in maxBlockSize. Otherwise we will roundup the request size to the next power of 2, wasting space, which is a bitpointless if we aren't going to make the blocks big enough to fit additionalstuff in them. The example motivating this is local buffer management, whichmakes repeated allocations of 8K (one BLCKSZ buffer) in TopMemoryContext,which has maxBlockSize = 8K because for the most part allocations there aresmall. This leads to each local buffer actually eating 16K of space, whichadds up when there are thousands of them. I intend to change localbuf.c toaggregate its requests, which will prevent this particular misbehavior, butit seems likely that similar scenarios could arise elsewhere, so fixing thecore problem seems wise as well.1 parent6bb7b46 commitc22dea8
1 file changed
+21
-6
lines changedLines changed: 21 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
14 |
| - | |
| 14 | + | |
15 | 15 |
| |
16 | 16 |
| |
17 | 17 |
| |
| |||
141 | 141 |
| |
142 | 142 |
| |
143 | 143 |
| |
| 144 | + | |
144 | 145 |
| |
145 | 146 |
| |
146 | 147 |
| |
| |||
328 | 329 |
| |
329 | 330 |
| |
330 | 331 |
| |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
331 | 346 |
| |
332 | 347 |
| |
333 | 348 |
| |
| |||
512 | 527 |
| |
513 | 528 |
| |
514 | 529 |
| |
515 |
| - | |
| 530 | + | |
516 | 531 |
| |
517 | 532 |
| |
518 | 533 |
| |
| |||
775 | 790 |
| |
776 | 791 |
| |
777 | 792 |
| |
778 |
| - | |
| 793 | + | |
779 | 794 |
| |
780 | 795 |
| |
781 | 796 |
| |
| |||
868 | 883 |
| |
869 | 884 |
| |
870 | 885 |
| |
871 |
| - | |
| 886 | + | |
872 | 887 |
| |
873 | 888 |
| |
874 | 889 |
| |
| |||
943 | 958 |
| |
944 | 959 |
| |
945 | 960 |
| |
946 |
| - | |
| 961 | + | |
947 | 962 |
| |
948 | 963 |
| |
949 | 964 |
| |
| |||
1122 | 1137 |
| |
1123 | 1138 |
| |
1124 | 1139 |
| |
1125 |
| - | |
| 1140 | + | |
1126 | 1141 |
| |
1127 | 1142 |
| |
1128 | 1143 |
| |
|
0 commit comments
Comments
(0)