forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit7413caa
committed
Avoid leaking memory during large-scale REASSIGN OWNED BY operations.
The various ALTER OWNER routines tend to leak memory inCurrentMemoryContext. That's not a problem when they're only calledonce per command; but in this usage where we might be touching manyobjects, it can amount to a serious memory leak. Fix that by runningeach call in a short-lived context.(DROP OWNED BY likely has a similar issue, except that you'll probablyrun out of lock table space before noticing. REASSIGN is worth fixingsince for most non-table object types, it won't take any lock.)Back-patch to all supported branches. Unfortunately, in the backbranches this helps to only a limited extent, since the sinval messagequeue bloats quite a lot in this usage before commit3aafc03,consuming memory more or less comparable to what's actually leaked.Still, it's clearly a leak with a simple fix, so we might as well fix it.Justin Pryzby, per report from Guillaume LelargeDiscussion:https://postgr.es/m/CAECtzeW2DAoioEGBRjR=CzHP6TdL=yosGku8qZxfX9hhtrBB0Q@mail.gmail.com1 parent64e8456 commit7413caa
1 file changed
+20
-0
lines changedLines changed: 20 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
65 | 65 |
| |
66 | 66 |
| |
67 | 67 |
| |
| 68 | + | |
68 | 69 |
| |
69 | 70 |
| |
70 | 71 |
| |
| |||
1508 | 1509 |
| |
1509 | 1510 |
| |
1510 | 1511 |
| |
| 1512 | + | |
| 1513 | + | |
1511 | 1514 |
| |
1512 | 1515 |
| |
1513 | 1516 |
| |
| |||
1525 | 1528 |
| |
1526 | 1529 |
| |
1527 | 1530 |
| |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
1528 | 1543 |
| |
1529 | 1544 |
| |
1530 | 1545 |
| |
| |||
1613 | 1628 |
| |
1614 | 1629 |
| |
1615 | 1630 |
| |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
1616 | 1636 |
| |
1617 | 1637 |
| |
1618 | 1638 |
| |
|
0 commit comments
Comments
(0)