$OpenBSD: patch-base_src_server_opencmserver_c,v 1.1 2003/05/23 13:22:14 todd Exp $
--- base/src/server/opencmserver.c.orig	Tue Apr 22 10:28:07 2003
+++ base/src/server/opencmserver.c	Thu May 22 17:46:43 2003
@@ -54,35 +54,6 @@ static int max_fd_so_far;
 /* defined in globals.h: */
 int num_active_clients = 0;
 
-static void
-report_gc_statistics()
-{
-  static size_t last_stats[5] = { 0 };
-  size_t stats_now[4];
-  int j, stats_changed = 0;
-
-  stats_now[0] = GC_get_heap_size();
-  stats_now[1] = GC_get_free_bytes();
-  stats_now[2] = GC_get_total_bytes();
-  stats_now[3] = GC_get_bytes_since_gc();
-
-  last_stats[4] += GC_get_bytes_since_gc();
-
-  for(j = 0; j != 4; j++)
-    if(stats_now[j] != last_stats[j])
-      stats_changed = 1;
-
-  for(j = 0; j != 4; j++)
-    last_stats[j] = stats_now[j];
-
-  /* Only make a report if something has changed since the last report */
-  if(!stats_changed)
-    return;
-
-  log_trace(DBG_GC, "GC: heap=%d free=%d tot_alloc=%d tot_free=%d since_last_gc=%d\n",
-         stats_now[0], stats_now[1], stats_now[2], last_stats[4], stats_now[3]);
-}
-
 static void 
 dump_channels(int sigid) 
 {
@@ -302,12 +273,8 @@ svr_GetRequest(Channel *c)
   }
 
   svr_DoRequest(c, request);
-  strm = 0;			/* GC */
-  request = 0;			/* GC */
-
-  /* Make sure to disable this if you're using reporting, since the GC free
-     statistics will get lost -JL */
-  GC_gcollect();
+  free(strm);
+  free(request);
 
   /* Restore the Channel's read callback
    * because the client is probably going to have
@@ -327,7 +294,7 @@ send_reply(Channel *c, Reply *reply)
   /* Make sure this buffer is malloc'd:  chan_awrite() relies
    * on the buffer pointer's validity well beyond the scope of this
    * local declaration block. */
-  char *totbuf = (char *)GC_MALLOC_ATOMIC(sizeof(reqlen_t));
+  char *totbuf = (char *)malloc(sizeof(reqlen_t));
 
   reply_strm = stream_createBuffer(SDR_WIRE);
   sdr_write(SERVERREPLY, reply_strm, reply);
@@ -581,10 +548,9 @@ svr_DoClientSetup(Channel *c)
     return;
   }
 
-  log_trace(TRC_COMM, "%s: Accepted connect from %s (connection id=%d, heap=%d)\n",
+  log_trace(TRC_COMM, "%s: Accepted connect from %s (connection id=%d)\n",
 	 os_GetISOTime(),
-	 pubkey_GetEmail(c->peerCert), c->connection_id,
-	 GC_get_heap_size());
+	 pubkey_GetEmail(c->peerCert), c->connection_id);
 
   chan_aread(c, sizeof(reqlen_t), svr_StartSession);
 }
@@ -612,7 +578,6 @@ opencm_server(WorkSpace *ws, int argc, c
   int u;
   Channel *listenChan;
   struct timeval tv;
-  size_t heap_size;
 
   /* Become a daemon unless debugging has been requested: */
   if (opt_Foreground)
@@ -702,28 +667,6 @@ opencm_server(WorkSpace *ws, int argc, c
       tv.tv_sec  = 0;
       tv.tv_usec = 250000;
       (void) chan_select(activeChannels, max_fd_so_far, &tv);
-
-      report_gc_statistics();
-
-      GC_gcollect();
-
-#ifdef MEMLEAK_PATCH
-      /* Temporary:  if GC_get_heap_size() > HEAPLIMIT then terminate
-	 svr as long as there are no active channels
-      */
-      heap_size = GC_get_heap_size();
-      svr_memory_error = heap_size > HEAP_LIMIT;
-
-      if (svr_memory_error) {
-	log_trace(ERR_GC, "** GC heap exceeded: limit = 0x%08x  current = 0x%08x "
-		  " active clients = %d\n", HEAP_LIMIT, heap_size, 
-		  num_active_clients);
-
-	/* If no outstanding requests, terminate:  */
-	if (num_active_clients <= 0)
-	  svr_Cleanup();
-      }
-#endif
 
     }
     DEFAULT(ex) {
