pgsql: Fix memory leak on DSM slot exhaustion.

Started by Thomas Munroover 6 years ago3 messagescomitters
Jump to latest
#1Thomas Munro
thomas.munro@gmail.com

Fix memory leak on DSM slot exhaustion.

If we attempt to create a DSM segment when no slots are available,
we should return the memory to the operating system. Previously
we did that if the DSM_CREATE_NULL_IF_MAXSEGMENTS flag was
passed in, but we didn't do it if an error was raised. Repair.

Back-patch to 9.4, where DSM segments arrived.

Author: Thomas Munro
Reviewed-by: Robert Haas
Reported-by: Julian Backes
Discussion: /messages/by-id/CA+hUKGKAAoEw-R4om0d2YM4eqT1eGEi6=Qot-3ceDR-SLiWVDw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/93745f1e019543fe7b742d0c5e971aad8d08fd56

Modified Files
--------------
src/backend/storage/ipc/dsm.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)

#2Michael Paquier
michael@paquier.xyz
In reply to: Thomas Munro (#1)
Re: pgsql: Fix memory leak on DSM slot exhaustion.

Hi Thomas,

On Sat, Feb 01, 2020 at 02:33:42AM +0000, Thomas Munro wrote:

Fix memory leak on DSM slot exhaustion.

If we attempt to create a DSM segment when no slots are available,
we should return the memory to the operating system. Previously
we did that if the DSM_CREATE_NULL_IF_MAXSEGMENTS flag was
passed in, but we didn't do it if an error was raised. Repair.

Back-patch to 9.4, where DSM segments arrived.

It seems to me that you have forgotten REL_11_STABLE in the set of
branches to fix.

Thanks,
--
Michael

#3Thomas Munro
thomas.munro@gmail.com
In reply to: Michael Paquier (#2)
Re: pgsql: Fix memory leak on DSM slot exhaustion.

On Sat, Feb 1, 2020 at 10:37 PM Michael Paquier <michael@paquier.xyz> wrote:

It seems to me that you have forgotten REL_11_STABLE in the set of
branches to fix.

Thanks for catching that. Pushed.