forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit467963c
committed
Prevent query-lifespan memory leakage of SP-GiST traversal values.
The original coding of the SP-GiST scan traversalValue feature (commitccd6eb4) arranged for traversal values to be stored in the query's mainexecutor context. That's fine if there's only one index scan per query,but if there are many, we have a memory leak as successive scans createnew traversal values. Fix it by creating a separate memory context fortraversal values, which we can reset during spgrescan(). Back-patchto 9.6 where this code was introduced.In principle, adding the traversalCxt field to SpGistScanOpaqueDatacreates an ABI break in the back branches. But I (tgl) have littlesympathy for extensions including spgist_private.h, so I'm not veryworried about that. Alternatively we could stick the new field at theend of the struct in back branches, but that has its own downsides.Anton Dignös, reviewed by Alexander KuzmenkovDiscussion:https://postgr.es/m/CALNdv1jb6y2Te-m8xHLxLX12RsBmZJ1f4hESX7J0HjgyOhA9eA@mail.gmail.com1 parent13c7c65 commit467963c
File tree
2 files changed
+9
-1
lines changed- src
- backend/access/spgist
- include/access
2 files changed
+9
-1
lines changedLines changed: 8 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
194 | 194 |
| |
195 | 195 |
| |
196 | 196 |
| |
| 197 | + | |
| 198 | + | |
| 199 | + | |
197 | 200 |
| |
198 | 201 |
| |
199 | 202 |
| |
| |||
209 | 212 |
| |
210 | 213 |
| |
211 | 214 |
| |
| 215 | + | |
| 216 | + | |
| 217 | + | |
212 | 218 |
| |
213 | 219 |
| |
214 | 220 |
| |
| |||
229 | 235 |
| |
230 | 236 |
| |
231 | 237 |
| |
| 238 | + | |
232 | 239 |
| |
233 | 240 |
| |
234 | 241 |
| |
| |||
463 | 470 |
| |
464 | 471 |
| |
465 | 472 |
| |
466 |
| - | |
| 473 | + | |
467 | 474 |
| |
468 | 475 |
| |
469 | 476 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
137 | 137 |
| |
138 | 138 |
| |
139 | 139 |
| |
| 140 | + | |
140 | 141 |
| |
141 | 142 |
| |
142 | 143 |
| |
|
0 commit comments
Comments
(0)