$OpenBSD: patch-src_runtime_Kernel_collector_c,v 1.1 2007/06/29 11:06:25 kili Exp $

From patch-1.18-himem. Put here because I'd problems fetching it
from ftp.cs.york.ac.uk.

--- src/runtime/Kernel/collector.c.orig	Mon Mar  7 17:53:38 2005
+++ src/runtime/Kernel/collector.c	Thu Jun  7 15:29:51 2007
@@ -9,6 +9,7 @@
 
 /*#define HEAPSIZE 100000  -- defined in top-level Makefile at config-time */
 #define GCSTACKSIZE 20000
+#define SBRK 1	/* Use sbrk(2) instead of malloc(3) to allocate the heap */
 
 WHEN_DYNAMIC(int ractive = 0;)
 
@@ -46,7 +47,13 @@ void initGc(Int hpSize,NodePtr *ihp,Int spSize,NodePtr
   Int totalSize = hpSize+spSize;
   Int tableSize = (totalSize+WORDSIZE)/(WORDSIZE+1)+1; /* Last one for end of marked */
 
-  if(NULL == (hpStart = malloc ((int)totalSize * sizeof(Node)))) {
+  if (
+#if SBRK
+      ((NodePtr)-1)== (hpStart = (NodePtr)sbrk((int)totalSize * sizeof(Node)))
+#else
+      NULL == (hpStart = malloc ((int)totalSize * sizeof(Node)))
+#endif
+     ) {
     fprintf(stderr,"Not enough memory for heap and stack.\n");
     exit(-1);
   }
