forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit407b50f
committed
Store GUC data in a memory context, instead of using malloc().
The only real argument for using malloc directly was that we neededthe ability to not throw error on OOM; but mcxt.c grew that featureawhile ago.Keeping the data in a memory context improves accountability anddebuggability --- for example, without this it's almost impossibleto detect memory leaks in the GUC code with anything less costlythan valgrind. Moreover, the next patch in this series will add ahash table for GUC lookup, and it'd be pretty silly to be usingpalloc-dependent hash facilities alongside malloc'd storage of theunderlying data.This is a bit invasive though, in particular causing an API breakfor GUC check hooks that want to modify the GUC's value or use an"extra" data structure. They must now use guc_malloc() andguc_free() instead of malloc() and free(). Failure to changeaffected code will result in assertion failures or worse; butthanks to recent effort in the mcxt infrastructure, it shouldn'tbe too hard to diagnose such oversights (at least in assert-enabledbuilds).One note is that this changes ParseLongOption() to return short-livedpalloc'd not malloc'd data. There wasn't any caller for which theprevious definition was better.Discussion:https://postgr.es/m/2982579.1662416866@sss.pgh.pa.us1 parent9c911ec commit407b50f
File tree
13 files changed
+185
-127
lines changed- src
- backend
- bootstrap
- commands
- postmaster
- replication
- tcop
- utils
- adt
- cache
- misc
- include/utils
- pl/plpgsql/src
13 files changed
+185
-127
lines changedLines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
287 | 287 |
| |
288 | 288 |
| |
289 | 289 |
| |
290 |
| - | |
291 |
| - | |
| 290 | + | |
| 291 | + | |
292 | 292 |
| |
293 | 293 |
| |
294 | 294 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1290 | 1290 |
| |
1291 | 1291 |
| |
1292 | 1292 |
| |
1293 |
| - | |
1294 |
| - | |
| 1293 | + | |
| 1294 | + | |
1295 | 1295 |
| |
1296 | 1296 |
| |
1297 | 1297 |
| |
|
Lines changed: 17 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
148 | 148 |
| |
149 | 149 |
| |
150 | 150 |
| |
151 |
| - | |
| 151 | + | |
152 | 152 |
| |
153 | 153 |
| |
154 | 154 |
| |
155 | 155 |
| |
156 | 156 |
| |
157 | 157 |
| |
158 | 158 |
| |
159 |
| - | |
| 159 | + | |
160 | 160 |
| |
161 | 161 |
| |
162 | 162 |
| |
| |||
165 | 165 |
| |
166 | 166 |
| |
167 | 167 |
| |
168 |
| - | |
169 |
| - | |
| 168 | + | |
| 169 | + | |
170 | 170 |
| |
171 | 171 |
| |
172 | 172 |
| |
| |||
187 | 187 |
| |
188 | 188 |
| |
189 | 189 |
| |
190 |
| - | |
| 190 | + | |
191 | 191 |
| |
192 |
| - | |
| 192 | + | |
193 | 193 |
| |
194 | 194 |
| |
195 | 195 |
| |
| |||
221 | 221 |
| |
222 | 222 |
| |
223 | 223 |
| |
224 |
| - | |
| 224 | + | |
225 | 225 |
| |
226 | 226 |
| |
227 | 227 |
| |
228 | 228 |
| |
229 | 229 |
| |
230 |
| - | |
| 230 | + | |
231 | 231 |
| |
232 | 232 |
| |
233 | 233 |
| |
| |||
366 | 366 |
| |
367 | 367 |
| |
368 | 368 |
| |
369 |
| - | |
| 369 | + | |
370 | 370 |
| |
371 | 371 |
| |
372 | 372 |
| |
| |||
439 | 439 |
| |
440 | 440 |
| |
441 | 441 |
| |
442 |
| - | |
| 442 | + | |
443 | 443 |
| |
444 | 444 |
| |
445 | 445 |
| |
| |||
500 | 500 |
| |
501 | 501 |
| |
502 | 502 |
| |
503 |
| - | |
| 503 | + | |
504 | 504 |
| |
505 | 505 |
| |
506 | 506 |
| |
| |||
647 | 647 |
| |
648 | 648 |
| |
649 | 649 |
| |
650 |
| - | |
| 650 | + | |
651 | 651 |
| |
652 | 652 |
| |
653 | 653 |
| |
| |||
735 | 735 |
| |
736 | 736 |
| |
737 | 737 |
| |
738 |
| - | |
739 |
| - | |
| 738 | + | |
| 739 | + | |
740 | 740 |
| |
741 | 741 |
| |
742 | 742 |
| |
743 | 743 |
| |
744 | 744 |
| |
745 | 745 |
| |
746 | 746 |
| |
747 |
| - | |
| 747 | + | |
748 | 748 |
| |
749 | 749 |
| |
750 | 750 |
| |
| |||
847 | 847 |
| |
848 | 848 |
| |
849 | 849 |
| |
850 |
| - | |
| 850 | + | |
851 | 851 |
| |
852 | 852 |
| |
853 | 853 |
| |
| |||
957 | 957 |
| |
958 | 958 |
| |
959 | 959 |
| |
960 |
| - | |
| 960 | + | |
961 | 961 |
| |
962 | 962 |
| |
963 | 963 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
849 | 849 |
| |
850 | 850 |
| |
851 | 851 |
| |
852 |
| - | |
853 |
| - | |
| 852 | + | |
| 853 | + | |
854 | 854 |
| |
855 | 855 |
| |
856 | 856 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1054 | 1054 |
| |
1055 | 1055 |
| |
1056 | 1056 |
| |
1057 |
| - | |
| 1057 | + | |
1058 | 1058 |
| |
1059 |
| - | |
| 1059 | + | |
1060 | 1060 |
| |
1061 | 1061 |
| |
1062 | 1062 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3871 | 3871 |
| |
3872 | 3872 |
| |
3873 | 3873 |
| |
3874 |
| - | |
3875 |
| - | |
| 3874 | + | |
| 3875 | + | |
3876 | 3876 |
| |
3877 | 3877 |
| |
3878 | 3878 |
| |
|
Lines changed: 4 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
29 | 29 |
| |
30 | 30 |
| |
31 | 31 |
| |
| 32 | + | |
32 | 33 |
| |
33 | 34 |
| |
34 | 35 |
| |
| |||
4782 | 4783 |
| |
4783 | 4784 |
| |
4784 | 4785 |
| |
4785 |
| - | |
4786 |
| - | |
| 4786 | + | |
| 4787 | + | |
4787 | 4788 |
| |
4788 | 4789 |
| |
4789 | 4790 |
| |
| |||
4812 | 4813 |
| |
4813 | 4814 |
| |
4814 | 4815 |
| |
4815 |
| - | |
| 4816 | + | |
4816 | 4817 |
| |
4817 | 4818 |
| |
4818 | 4819 |
| |
|
Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
633 | 633 |
| |
634 | 634 |
| |
635 | 635 |
| |
636 |
| - | |
637 |
| - | |
638 |
| - | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
639 | 639 |
| |
640 | 640 |
| |
641 | 641 |
| |
|
Lines changed: 7 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
51 | 51 |
| |
52 | 52 |
| |
53 | 53 |
| |
54 |
| - | |
55 |
| - | |
| 54 | + | |
| 55 | + | |
56 | 56 |
| |
57 | 57 |
| |
58 |
| - | |
| 58 | + | |
59 | 59 |
| |
60 |
| - | |
| 60 | + | |
61 | 61 |
| |
62 | 62 |
| |
63 | 63 |
| |
| |||
255 | 255 |
| |
256 | 256 |
| |
257 | 257 |
| |
258 |
| - | |
259 |
| - | |
260 |
| - | |
261 |
| - | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
262 | 261 |
| |
263 | 262 |
| |
264 | 263 |
| |
|
0 commit comments
Comments
(0)