forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit07172d5
committed
Avoid query-lifetime memory leaks in XMLTABLE (bug #15321)
Multiple calls to XMLTABLE in a query (e.g. laterally applying it to atable with an xml column, an important use-case) were leaking largeamounts of memory into the per-query context, blowing up memory usage.Repair by reorganizing memory context usage in nodeTableFuncscan; usethe usual per-tuple context for row-by-row evaluations instead ofperValueCxt, and use the explicitly created context -- renamed fromperValueCxt to perTableCxt -- for arguments and state for eachindividual table-generation operation.Backpatch to PG10 where this code was introduced.Original report by IRC user begriffs; analysis and patch by me.Reviewed by Tom Lane and Pavel Stehule.Discussion:https://postgr.es/m/153394403528.10284.7530399040974170549@wrigleys.postgresql.org1 parent46b5e7c commit07172d5
File tree
2 files changed
+25
-6
lines changed- src
- backend/executor
- include/nodes
2 files changed
+25
-6
lines changedLines changed: 24 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
164 | 164 |
| |
165 | 165 |
| |
166 | 166 |
| |
167 |
| - | |
| 167 | + | |
168 | 168 |
| |
169 | 169 |
| |
170 | 170 |
| |
| |||
282 | 282 |
| |
283 | 283 |
| |
284 | 284 |
| |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
285 | 295 |
| |
286 | 296 |
| |
287 | 297 |
| |
| |||
313 | 323 |
| |
314 | 324 |
| |
315 | 325 |
| |
316 |
| - | |
317 |
| - | |
| 326 | + | |
318 | 327 |
| |
319 | 328 |
| |
320 | 329 |
| |
321 | 330 |
| |
322 | 331 |
| |
323 | 332 |
| |
324 | 333 |
| |
| 334 | + | |
| 335 | + | |
| 336 | + | |
325 | 337 |
| |
326 | 338 |
| |
327 | 339 |
| |
| |||
428 | 440 |
| |
429 | 441 |
| |
430 | 442 |
| |
431 |
| - | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
432 | 451 |
| |
433 | 452 |
| |
434 | 453 |
| |
| |||
493 | 512 |
| |
494 | 513 |
| |
495 | 514 |
| |
496 |
| - | |
| 515 | + | |
497 | 516 |
| |
498 | 517 |
| |
499 | 518 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1580 | 1580 |
| |
1581 | 1581 |
| |
1582 | 1582 |
| |
1583 |
| - | |
| 1583 | + | |
1584 | 1584 |
| |
1585 | 1585 |
| |
1586 | 1586 |
| |
|
0 commit comments
Comments
(0)