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

Commit42e2ce6

Browse files
committed
Fix confusion between "size" and "AnonymousShmemSize".
Noted by Andres Freund. Also improve a couple of comments.
1 parent7a5c9ca commit42e2ce6

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

‎src/backend/port/sysv_shmem.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,13 +408,14 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
408408
longpagesize=sysconf(_SC_PAGE_SIZE);
409409

410410
/*
411+
* Ensure request size is a multiple of pagesize.
412+
*
411413
* pagesize will, for practical purposes, always be a power of two.
412414
* But just in case it isn't, we do it this way instead of using
413415
* TYPEALIGN().
414416
*/
415-
AnonymousShmemSize=size;
416-
if (size %pagesize!=0)
417-
AnonymousShmemSize+=pagesize- (size %pagesize);
417+
if (pagesize>0&&size %pagesize!=0)
418+
size+=pagesize- (size %pagesize);
418419

419420
/*
420421
* We assume that no one will attempt to run PostgreSQL 9.3 or later
@@ -435,9 +436,10 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
435436
"%lu bytes), reduce PostgreSQL's shared memory usage, "
436437
"perhaps by reducing shared_buffers or "
437438
"max_connections.",
438-
(unsigned long)AnonymousShmemSize) :0));
439+
(unsigned long)size) :0));
440+
AnonymousShmemSize=size;
439441

440-
/* Now wecanallocate a minimal SHM block. */
442+
/* Now weneed onlyallocate a minimal-sized SysV shmem block. */
441443
allocsize=sizeof(PGShmemHeader);
442444
}
443445
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp