forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit5561404
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 parent26853a8 commit5561404
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 | |
---|---|---|---|
| |||
170 | 170 |
| |
171 | 171 |
| |
172 | 172 |
| |
173 |
| - | |
| 173 | + | |
174 | 174 |
| |
175 | 175 |
| |
176 | 176 |
| |
| |||
288 | 288 |
| |
289 | 289 |
| |
290 | 290 |
| |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
291 | 301 |
| |
292 | 302 |
| |
293 | 303 |
| |
| |||
319 | 329 |
| |
320 | 330 |
| |
321 | 331 |
| |
322 |
| - | |
323 |
| - | |
| 332 | + | |
324 | 333 |
| |
325 | 334 |
| |
326 | 335 |
| |
327 | 336 |
| |
328 | 337 |
| |
329 | 338 |
| |
330 | 339 |
| |
| 340 | + | |
| 341 | + | |
| 342 | + | |
331 | 343 |
| |
332 | 344 |
| |
333 | 345 |
| |
| |||
433 | 445 |
| |
434 | 446 |
| |
435 | 447 |
| |
436 |
| - | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
437 | 456 |
| |
438 | 457 |
| |
439 | 458 |
| |
| |||
496 | 515 |
| |
497 | 516 |
| |
498 | 517 |
| |
499 |
| - | |
| 518 | + | |
500 | 519 |
| |
501 | 520 |
| |
502 | 521 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1484 | 1484 |
| |
1485 | 1485 |
| |
1486 | 1486 |
| |
1487 |
| - | |
| 1487 | + | |
1488 | 1488 |
| |
1489 | 1489 |
| |
1490 | 1490 |
| |
|
0 commit comments
Comments
(0)