Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue 2046: Memory leak during btree(agtype) (#2060) #2069

Merged
merged 1 commit into from
Aug 23, 2024

Conversation

jrgemignani
Copy link
Contributor

Fixed the memory leaks during a btree index build.

The issue has to do with how PostgreSQL allocates and frees its memory. Usually, contexts are destroyed, freeing up the memory in that context for the functions. However, sometimes this destruction happens way too late for it to be helpful. In the case of btree compare, the context destruction doesn't happen until after the sort has completed. The solution is to add in pfrees to manage the memory we use, ourselves.

Additionally, propagated these changes to a few other functions. More PRs will be created to address other locations where this applies.

No regression tests were impacted.
No additionall regression tests are needed.

Fixed the memory leaks during a btree index build.

The issue has to do with how PostgreSQL allocates and frees its
memory. Usually, contexts are destroyed, freeing up the memory in
that context for the functions.  However, sometimes this destruction
happens way too late for it to be helpful. In the case of btree
compare, the context destruction doesn't happen until after the sort
has completed. The solution is to add in pfrees to manage the memory
we use, ourselves.

Additionally, propagated these changes to a few other functions. More
PRs will be created to address other locations where this applies.

No regression tests were impacted.
No additionall regression tests are needed.
@github-actions github-actions bot added PG16 override-stale To keep issues/PRs untouched from stale action labels Aug 22, 2024
@MuhammadTahaNaveed MuhammadTahaNaveed merged commit 038c1e1 into apache:PG16 Aug 23, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
override-stale To keep issues/PRs untouched from stale action PG16
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants