diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 4633ddef4644d6b6c68f2992e6f6c1e1ba02bfc7..f148a5ea0051d3e3c792b7dc96b8c600dd9957cd 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.191 2005/08/08 03:11:44 tgl Exp $
+ *	  $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.192 2005/08/08 19:44:22 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1067,15 +1067,18 @@ void
 AtEOXact_Buffers(bool isCommit)
 {
 #ifdef USE_ASSERT_CHECKING
-	int			i;
-
-	for (i = 0; i < NBuffers; i++)
+	if (assert_enabled)
 	{
-		Assert(PrivateRefCount[i] == 0);
+		int			i;
+
+		for (i = 0; i < NBuffers; i++)
+		{
+			Assert(PrivateRefCount[i] == 0);
+		}
 	}
+#endif
 
 	AtEOXact_LocalBuffers(isCommit);
-#endif
 
 	/* Make sure we reset the strategy hint in case VACUUM errored out */
 	StrategyHintVacuum(false);
diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c
index a2604dcf550e0641c13573392c3873709a67b3a4..6ac0b543ae386504af42aca730015c6a2760f68a 100644
--- a/src/backend/storage/buffer/localbuf.c
+++ b/src/backend/storage/buffer/localbuf.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.67 2005/05/29 04:23:04 tgl Exp $
+ *	  $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.68 2005/08/08 19:44:22 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -308,11 +308,14 @@ void
 AtEOXact_LocalBuffers(bool isCommit)
 {
 #ifdef USE_ASSERT_CHECKING
-	int			i;
-
-	for (i = 0; i < NLocBuffer; i++)
+	if (assert_enabled)
 	{
-		Assert(LocalRefCount[i] == 0);
+		int			i;
+
+		for (i = 0; i < NLocBuffer; i++)
+		{
+			Assert(LocalRefCount[i] == 0);
+		}
 	}
 #endif
 }