diff --git a/src/backend/storage/ipc/shmem.c b/src/backend/storage/ipc/shmem.c
index 4c590a2774bbc5bbc5c6819b38bdf2496e536183..0fa6c54256a043aea9a7a21a32435e2a0e12ec35 100644
--- a/src/backend/storage/ipc/shmem.c
+++ b/src/backend/storage/ipc/shmem.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.52 2000/06/28 03:31:57 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.53 2000/07/25 20:17:02 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -171,17 +171,18 @@ InitShmem(unsigned int key, unsigned int size)
 	/* get pointers to the dimensions of shared memory */
 	ShmemBase = (unsigned long) sharedRegion;
 	ShmemEnd = (unsigned long) sharedRegion + ShmemSize;
-	currFreeSpace = 0;
 
-	/* First long in shared memory is the count of available space */
+	/* First long in shared memory is the available-space pointer */
 	ShmemFreeStart = (unsigned long *) ShmemBase;
 	/* next is a shmem pointer to the shmem index */
 	ShmemIndexOffset = ShmemFreeStart + 1;
 	/* next is ShmemVariableCache */
 	ShmemVariableCache = (VariableCache) (ShmemIndexOffset + 1);
 
-	currFreeSpace += sizeof(ShmemFreeStart) + sizeof(ShmemIndexOffset) +
-		LONGALIGN(sizeof(VariableCacheData));
+	/* here is where to start dynamic allocation */
+	currFreeSpace = MAXALIGN(sizeof(*ShmemFreeStart) +
+							 sizeof(*ShmemIndexOffset) +
+							 sizeof(*ShmemVariableCache));
 
 	/*
 	 * bootstrap initialize spin locks so we can start to use the
@@ -510,7 +511,7 @@ ShmemInitStruct(char *name, Size size, bool *foundPtr)
 		}
 		else
 		{
-			Assert(ShmemIndexOffset);
+			Assert(*ShmemIndexOffset);
 
 			*foundPtr = TRUE;
 			return (void *) MAKE_PTR(*ShmemIndexOffset);