Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit600387f

Browse files
committed
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. Previouslywe did that if the DSM_CREATE_NULL_IF_MAXSEGMENTS flag waspassed in, but we didn't do it if an error was raised. Repair.Back-patch to 9.4, where DSM segments arrived.Author: Thomas MunroReviewed-by: Robert HaasReported-by: Julian BackesDiscussion:https://postgr.es/m/CA%2BhUKGKAAoEw-R4om0d2YM4eqT1eGEi6%3DQot-3ceDR-SLiWVDw%40mail.gmail.com
1 parent25dc267 commit600387f

File tree

1 file changed

+8
-9
lines changed
  • src/backend/storage/ipc

1 file changed

+8
-9
lines changed

‎src/backend/storage/ipc/dsm.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -499,17 +499,16 @@ dsm_create(Size size, int flags)
499499
/* Verify that we can support an additional mapping. */
500500
if (nitems >=dsm_control->maxitems)
501501
{
502+
LWLockRelease(DynamicSharedMemoryControlLock);
503+
dsm_impl_op(DSM_OP_DESTROY,seg->handle,0,&seg->impl_private,
504+
&seg->mapped_address,&seg->mapped_size,WARNING);
505+
if (seg->resowner!=NULL)
506+
ResourceOwnerForgetDSM(seg->resowner,seg);
507+
dlist_delete(&seg->node);
508+
pfree(seg);
509+
502510
if ((flags&DSM_CREATE_NULL_IF_MAXSEGMENTS)!=0)
503-
{
504-
LWLockRelease(DynamicSharedMemoryControlLock);
505-
dsm_impl_op(DSM_OP_DESTROY,seg->handle,0,&seg->impl_private,
506-
&seg->mapped_address,&seg->mapped_size,WARNING);
507-
if (seg->resowner!=NULL)
508-
ResourceOwnerForgetDSM(seg->resowner,seg);
509-
dlist_delete(&seg->node);
510-
pfree(seg);
511511
returnNULL;
512-
}
513512
ereport(ERROR,
514513
(errcode(ERRCODE_INSUFFICIENT_RESOURCES),
515514
errmsg("too many dynamic shared memory segments")));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp