- Notifications
You must be signed in to change notification settings - Fork5.2k
Commit1681a70
committed
Fix memory leak in _gin_parallel_merge
To insert the merged GIN entries in _gin_parallel_merge, the leadercalls ginEntryInsert(). This may allocate memory, e.g. for a new leaftuple. This was allocated in the PortalContext, and kept until the endof the index build. For most GIN indexes the amount of leaked memory isnegligible, but for custom opclasses with large keys it may cause OOMs.Fixed by calling ginEntryInsert() in a temporary memory context, resetafter each insert. Other ginEntryInsert() callers do this too, exceptthat the context is reset after batches of inserts. More frequent resetsdon't seem to hurt performance, it may even help it a bit.Report and fix by Vinod Sridharan.Author: Vinod Sridharan <vsridh90@gmail.com>Reviewed-by: Tomas Vondra <tomas@vondra.me>Discussion:https://postgr.es/m/CAFMdLD4p0VBd8JG=Nbi=BKv6rzFAiGJ_sXSFrw-2tNmNZFO5Kg@mail.gmail.com1 parente83a8ae commit1681a70
1 file changed
+12
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1669 | 1669 | | |
1670 | 1670 | | |
1671 | 1671 | | |
| 1672 | + | |
| 1673 | + | |
1672 | 1674 | | |
1673 | 1675 | | |
1674 | 1676 | | |
| |||
1685 | 1687 | | |
1686 | 1688 | | |
1687 | 1689 | | |
| 1690 | + | |
| 1691 | + | |
1688 | 1692 | | |
1689 | 1693 | | |
1690 | 1694 | | |
1691 | 1695 | | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
1692 | 1699 | | |
1693 | 1700 | | |
1694 | 1701 | | |
| |||
1711 | 1718 | | |
1712 | 1719 | | |
1713 | 1720 | | |
| 1721 | + | |
| 1722 | + | |
1714 | 1723 | | |
1715 | 1724 | | |
1716 | 1725 | | |
1717 | 1726 | | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
1718 | 1730 | | |
1719 | 1731 | | |
1720 | 1732 | | |
| |||
0 commit comments
Comments
(0)