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

Commitedf497d

Browse files
committed
Avoid palloc(0) when MaxBackends = 1.
1 parent9886a46 commitedf497d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

‎src/backend/storage/lmgr/deadlock.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
*
1414
* IDENTIFICATION
15-
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/deadlock.c,v 1.13 2002/09/04 20:31:25 momjian Exp $
15+
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/deadlock.c,v 1.14 2002/10/03 19:17:55 tgl Exp $
1616
*
1717
*Interface:
1818
*
@@ -125,9 +125,11 @@ InitDeadLockChecking(void)
125125
* We need to consider rearranging at most MaxBackends/2 wait queues
126126
* (since it takes at least two waiters in a queue to create a soft
127127
* edge), and the expanded form of the wait queues can't involve more
128-
* than MaxBackends total waiters.
128+
* than MaxBackends total waiters. (But avoid palloc(0) if
129+
* MaxBackends = 1.)
129130
*/
130-
waitOrders= (WAIT_ORDER*)palloc((MaxBackends /2)*sizeof(WAIT_ORDER));
131+
waitOrders= (WAIT_ORDER*)
132+
palloc(((MaxBackends+1) /2)*sizeof(WAIT_ORDER));
131133
waitOrderProcs= (PGPROC**)palloc(MaxBackends*sizeof(PGPROC*));
132134

133135
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp