|
12 | 12 | * |
13 | 13 | * |
14 | 14 | * 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 $ |
16 | 16 | * |
17 | 17 | *Interface: |
18 | 18 | * |
@@ -125,9 +125,11 @@ InitDeadLockChecking(void) |
125 | 125 | * We need to consider rearranging at most MaxBackends/2 wait queues |
126 | 126 | * (since it takes at least two waiters in a queue to create a soft |
127 | 127 | * 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.) |
129 | 130 | */ |
130 | | -waitOrders= (WAIT_ORDER*)palloc((MaxBackends /2)*sizeof(WAIT_ORDER)); |
| 131 | +waitOrders= (WAIT_ORDER*) |
| 132 | +palloc(((MaxBackends+1) /2)*sizeof(WAIT_ORDER)); |
131 | 133 | waitOrderProcs= (PGPROC**)palloc(MaxBackends*sizeof(PGPROC*)); |
132 | 134 |
|
133 | 135 | /* |
|