Skip to content

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.

Resolved Conflicts:
src/backend/utils/adt/agtype.c

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.

Resolved Conflicts:
	src/backend/utils/adt/agtype.c
@github-actions github-actions bot added PG14 PostgreSQL14 override-stale To keep issues/PRs untouched from stale action labels Aug 22, 2024
@MuhammadTahaNaveed MuhammadTahaNaveed merged commit a7866c4 into apache:PG14 Aug 23, 2024
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 PG14 PostgreSQL14

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants