]> code.delx.au - gnu-emacs/blobdiff - src/ralloc.c
* custom.texi (Init Examples): Add example of changing load-path.
[gnu-emacs] / src / ralloc.c
index dca5c2c6004255cbede84a7675efa7858a77082d..f5ebb8449ca57374d50f399803f9475807c96792 100644 (file)
@@ -1,12 +1,13 @@
-/* Block-relocating memory allocator. 
-   Copyright (C) 1993, 1995 Free Software Foundation, Inc.
+/* Block-relocating memory allocator.
+   Copyright (C) 1993, 1995, 2000, 2001, 2002, 2003, 2004,
+                 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
-GNU Emacs is free software; you can redistribute it and/or modify
+GNU Emacs is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -14,9 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* NOTES:
 
@@ -28,36 +27,28 @@ Boston, MA 02111-1307, USA.  */
 
 #include <config.h>
 #include "lisp.h"              /* Needed for VALBITS.  */
+#include "blockinput.h"
 
-#undef NULL
-
-/* The important properties of this type are that 1) it's a pointer, and
-   2) arithmetic on it should work as if the size of the object pointed
-   to has a size of 1.  */
-#if 0 /* Arithmetic on void* is a GCC extension.  */
-#ifdef __STDC__
-typedef void *POINTER;
-#else
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-typedef char *POINTER;
-
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
 #endif
-#endif /* 0 */
 
-/* Unconditionally use char * for this.  */
-typedef char *POINTER;
-
-typedef unsigned long SIZE;
+typedef POINTER_TYPE *POINTER;
+typedef size_t SIZE;
 
 /* Declared in dispnew.c, this version doesn't screw up if regions
    overlap.  */
+
 extern void safe_bcopy ();
 
-extern int __malloc_extra_blocks;
+#ifdef DOUG_LEA_MALLOC
+#define M_TOP_PAD           -2
+extern int mallopt ();
+#else /* not DOUG_LEA_MALLOC */
+#ifndef SYSTEM_MALLOC
+extern size_t __malloc_extra_blocks;
+#endif /* SYSTEM_MALLOC */
+#endif /* not DOUG_LEA_MALLOC */
 
 #else /* not emacs */
 
@@ -68,13 +59,13 @@ typedef void *POINTER;
 
 #include <unistd.h>
 #include <malloc.h>
-#include <string.h>
 
 #define safe_bcopy(x, y, z) memmove (y, x, z)
 #define bzero(x, len) memset (x, 0, len)
 
 #endif /* not emacs */
 
+
 #include "getpagesize.h"
 
 #define NIL ((POINTER) 0)
@@ -84,15 +75,18 @@ typedef void *POINTER;
    machines, the dumping procedure makes all static variables
    read-only.  On these machines, the word static is #defined to be
    the empty string, meaning that r_alloc_initialized becomes an
-   automatic variable, and loses its value each time Emacs is started up.  */
+   automatic variable, and loses its value each time Emacs is started
+   up.  */
+
 static int r_alloc_initialized = 0;
 
 static void r_alloc_init ();
+
 \f
 /* Declarations for working with the malloc, ralloc, and system breaks.  */
 
 /* Function to set the real break value.  */
-static POINTER (*real_morecore) ();
+POINTER (*real_morecore) ();
 
 /* The break value, as seen by malloc.  */
 static POINTER virtual_break_value;
@@ -104,7 +98,7 @@ static POINTER break_value;
 /* This is the size of a page.  We round memory requests to this boundary.  */
 static int page_size;
 
-/* Whenever we get memory from the system, get this many extra bytes.  This 
+/* Whenever we get memory from the system, get this many extra bytes.  This
    must be a multiple of page_size.  */
 static int extra_bytes;
 
@@ -119,7 +113,20 @@ static int extra_bytes;
 #define MEM_ALIGN sizeof(double)
 #define MEM_ROUNDUP(addr) (((unsigned long int)(addr) + MEM_ALIGN - 1) \
                                   & ~(MEM_ALIGN - 1))
+
+/* The hook `malloc' uses for the function which gets more space
+   from the system.  */
+
+#ifndef SYSTEM_MALLOC
+extern POINTER (*__morecore) ();
+#endif
+
+
 \f
+/***********************************************************************
+                     Implementation using sbrk
+ ***********************************************************************/
+
 /* Data structures of heaps and blocs.  */
 
 /* The relocatable objects, or blocs, and the malloc data
@@ -134,7 +141,7 @@ static int extra_bytes;
    We try to make just one heap and make it larger as necessary.
    But sometimes we can't do that, because we can't get contiguous
    space to add onto the heap.  When that happens, we start a new heap.  */
-   
+
 typedef struct heap
 {
   struct heap *next;
@@ -167,12 +174,12 @@ static heap_ptr first_heap, last_heap;
 /* These structures are allocated in the malloc arena.
    The linked list is kept in order of increasing '.data' members.
    The data blocks abut each other; if b->next is non-nil, then
-   b->data + b->size == b->next->data.  
+   b->data + b->size == b->next->data.
 
    An element with variable==NIL denotes a freed block, which has not yet
-   been collected.  They may only appear while r_alloc_freeze > 0, and will be
-   freed when the arena is thawed.  Currently, these blocs are not reusable,
-   while the arena is frozen.  Very inefficient.  */
+   been collected.  They may only appear while r_alloc_freeze_level > 0,
+   and will be freed when the arena is thawed.  Currently, these blocs are
+   not reusable, while the arena is frozen.  Very inefficient.  */
 
 typedef struct bp
 {
@@ -254,7 +261,7 @@ obtain (address, size)
 
   /* If we can't fit SIZE bytes in that heap,
      try successive later heaps.  */
-  while (heap && address + size > heap->end)
+  while (heap && (char *) address + size > (char *) heap->end)
     {
       heap = heap->next;
       if (heap == NIL_HEAP)
@@ -278,7 +285,7 @@ obtain (address, size)
          heap_ptr new_heap = (heap_ptr) MEM_ROUNDUP (new);
          POINTER bloc_start = (POINTER) MEM_ROUNDUP ((POINTER)(new_heap + 1));
 
-         if ((*real_morecore) (bloc_start - new) != new)
+         if ((*real_morecore) ((char *) bloc_start - (char *) new) != new)
            return 0;
 
          new_heap->start = new;
@@ -306,7 +313,7 @@ obtain (address, size)
       if ((*real_morecore) (get) != last_heap->end)
        return 0;
 
-      last_heap->end += get;
+      last_heap->end = (char *) last_heap->end + get;
     }
 
   return address;
@@ -321,7 +328,7 @@ static void
 relinquish ()
 {
   register heap_ptr h;
-  int excess = 0;
+  long excess = 0;
 
   /* Add the amount of space beyond break_value
      in all heaps which have extend beyond break_value at all.  */
@@ -354,11 +361,22 @@ relinquish ()
        {
          excess = (char *) last_heap->end
                        - (char *) ROUNDUP ((char *)last_heap->end - excess);
-         last_heap->end -= excess;
+         last_heap->end = (char *) last_heap->end - excess;
        }
 
       if ((*real_morecore) (- excess) == 0)
-       abort ();
+       {
+         /* If the system didn't want that much memory back, adjust
+             the end of the last heap to reflect that.  This can occur
+             if break_value is still within the original data segment.  */
+         last_heap->end = (char *) last_heap->end + excess;
+         /* Make sure that the result of the adjustment is accurate.
+             It should be, for the else clause above; the other case,
+             which returns the entire last heap to the system, seems
+             unlikely to trigger this mode of failure.  */
+         if (last_heap->end != (*real_morecore) (0))
+           abort ();
+       }
     }
 }
 
@@ -368,7 +386,7 @@ relinquish ()
 long
 r_alloc_size_in_use ()
 {
-  return break_value - virtual_break_value;
+  return (char *) break_value - (char *) virtual_break_value;
 }
 \f
 /* The meat - allocating, freeing, and relocating blocs.  */
@@ -384,6 +402,11 @@ find_bloc (ptr)
 
   while (p != NIL_BLOC)
     {
+      /* Consistency check. Don't return inconsistent blocs.
+        Don't abort here, as callers might be expecting this,  but
+        callers that always expect a bloc to be returned should abort
+        if one isn't to avoid a memory corruption bug that is
+        difficult to track down.  */
       if (p->variable == ptr && p->data == *ptr)
        return p;
 
@@ -407,13 +430,12 @@ get_bloc (size)
   if (! (new_bloc = (bloc_ptr) malloc (BLOC_PTR_SIZE))
       || ! (new_bloc->data = obtain (break_value, size)))
     {
-      if (new_bloc)
-       free (new_bloc);
+      free (new_bloc);
 
       return 0;
     }
 
-  break_value = new_bloc->data + size;
+  break_value = (char *) new_bloc->data + size;
 
   new_bloc->size = size;
   new_bloc->next = NIL_BLOC;
@@ -449,8 +471,8 @@ get_bloc (size)
 /* Calculate new locations of blocs in the list beginning with BLOC,
    relocating it to start at ADDRESS, in heap HEAP.  If enough space is
    not presently available in our reserve, call obtain for
-   more space. 
-   
+   more space.
+
    Store the new location of each bloc in its new_data field.
    Do not touch the contents of blocs or break_value.  */
 
@@ -463,14 +485,14 @@ relocate_blocs (bloc, heap, address)
   register bloc_ptr b = bloc;
 
   /* No need to ever call this if arena is frozen, bug somewhere!  */
-  if (r_alloc_freeze_level) 
+  if (r_alloc_freeze_level)
     abort();
 
   while (b)
     {
       /* If bloc B won't fit within HEAP,
         move to the next heap and try again.  */
-      while (heap && address + b->size > heap->end)
+      while (heap && (char *) address + b->size > (char *) heap->end)
        {
          heap = heap->next;
          if (heap == NIL_HEAP)
@@ -488,7 +510,7 @@ relocate_blocs (bloc, heap, address)
          /* Add up the size of all the following blocs.  */
          while (tb != NIL_BLOC)
            {
-             if (tb->variable) 
+             if (tb->variable)
                s += tb->size;
 
              tb = tb->next;
@@ -505,8 +527,8 @@ relocate_blocs (bloc, heap, address)
       /* Record the new address of this bloc
         and update where the next bloc can start.  */
       b->new_data = address;
-      if (b->variable) 
-       address += b->size;
+      if (b->variable)
+       address = (char *) address + b->size;
       b = b->next;
     }
 
@@ -558,7 +580,7 @@ update_heap_bloc_correspondence (bloc, heap)
     {
       /* The previous bloc is in HEAP.  */
       heap->last_bloc = bloc->prev;
-      heap->free = bloc->prev->data + bloc->prev->size;
+      heap->free = (char *) bloc->prev->data + bloc->prev->size;
     }
   else
     {
@@ -586,7 +608,7 @@ update_heap_bloc_correspondence (bloc, heap)
        }
 
       /* Update HEAP's status for bloc B.  */
-      heap->free = b->data + b->size;
+      heap->free = (char *) b->data + b->size;
       heap->last_bloc = b;
       if (heap->first_bloc == NIL_BLOC)
        heap->first_bloc = b;
@@ -621,7 +643,7 @@ resize_bloc (bloc, size)
   SIZE old_size;
 
   /* No need to ever call this if arena is frozen, bug somewhere!  */
-  if (r_alloc_freeze_level) 
+  if (r_alloc_freeze_level)
     abort();
 
   if (bloc == NIL_BLOC || size == bloc->size)
@@ -640,8 +662,8 @@ resize_bloc (bloc, size)
   bloc->size = size;
 
   /* Note that bloc could be moved into the previous heap.  */
-  address = (bloc->prev ? bloc->prev->data + bloc->prev->size
-            : first_heap->bloc_start);
+  address = (bloc->prev ? (char *) bloc->prev->data + bloc->prev->size
+            : (char *) first_heap->bloc_start);
   while (heap)
     {
       if (heap->bloc_start <= address && address <= heap->end)
@@ -663,8 +685,8 @@ resize_bloc (bloc, size)
            {
              b->size = 0;
              b->data = b->new_data;
-            } 
-         else 
+            }
+         else
            {
              safe_bcopy (b->data, b->new_data, b->size);
              *b->variable = b->data = b->new_data;
@@ -678,7 +700,7 @@ resize_bloc (bloc, size)
       else
        {
          safe_bcopy (bloc->data, bloc->new_data, old_size);
-         bzero (bloc->new_data + old_size, size - old_size);
+         bzero ((char *) bloc->new_data + old_size, size - old_size);
          *bloc->variable = bloc->data = bloc->new_data;
        }
     }
@@ -690,8 +712,8 @@ resize_bloc (bloc, size)
            {
              b->size = 0;
              b->data = b->new_data;
-            } 
-         else 
+            }
+         else
            {
              safe_bcopy (b->data, b->new_data, b->size);
              *b->variable = b->data = b->new_data;
@@ -701,8 +723,8 @@ resize_bloc (bloc, size)
 
   update_heap_bloc_correspondence (bloc, heap);
 
-  break_value = (last_bloc ? last_bloc->data + last_bloc->size
-                : first_heap->bloc_start);
+  break_value = (last_bloc ? (char *) last_bloc->data + last_bloc->size
+                : (char *) first_heap->bloc_start);
   return 1;
 }
 \f
@@ -720,7 +742,7 @@ free_bloc (bloc)
       bloc->variable = (POINTER *) NIL;
       return;
     }
-  
+
   resize_bloc (bloc, 0);
 
   if (bloc == first_bloc && bloc == last_bloc)
@@ -776,7 +798,7 @@ free_bloc (bloc)
    __morecore hook values - in particular, __default_morecore in the
    GNU malloc package.  */
 
-POINTER 
+POINTER
 r_alloc_sbrk (size)
      long size;
 {
@@ -832,7 +854,7 @@ r_alloc_sbrk (size)
       if (first_heap->bloc_start < new_bloc_start)
        {
          /* This is no clean solution - no idea how to do it better.  */
-         if (r_alloc_freeze_level) 
+         if (r_alloc_freeze_level)
            return NIL;
 
          /* There is a bug here: if the above obtain call succeeded, but the
@@ -908,21 +930,22 @@ r_alloc_sbrk (size)
 
   virtual_break_value = (POINTER) ((char *)address + size);
   break_value = (last_bloc
-                ? last_bloc->data + last_bloc->size
-                : first_heap->bloc_start);
+                ? (char *) last_bloc->data + last_bloc->size
+                : (char *) first_heap->bloc_start);
   if (size < 0)
     relinquish ();
 
   return address;
 }
 
+
 /* Allocate a relocatable bloc of storage of size SIZE.  A pointer to
    the data is returned in *PTR.  PTR is thus the address of some variable
    which will use the data area.
 
    The allocation of 0 bytes is valid.
-   In case r_alloc_freeze is set, a best fit of unused blocs could be done
-   before allocating a new area.  Not yet done.
+   In case r_alloc_freeze_level is set, a best fit of unused blocs could be
+   done before allocating a new area.  Not yet done.
 
    If we can't allocate the necessary memory, set *PTR to zero, and
    return zero.  */
@@ -963,7 +986,7 @@ r_alloc_free (ptr)
 
   dead_bloc = find_bloc (ptr);
   if (dead_bloc == NIL_BLOC)
-    abort ();
+    abort (); /* Double free? PTR not originally used to allocate?  */
 
   free_bloc (dead_bloc);
   *ptr = 0;
@@ -978,7 +1001,7 @@ r_alloc_free (ptr)
    SIZE is less than or equal to the current bloc size, in which case
    do nothing.
 
-   In case r_alloc_freeze is set, a new bloc is allocated, and the
+   In case r_alloc_freeze_level is set, a new bloc is allocated, and the
    memory copied to it.  Not very efficient.  We could traverse the
    bloc_list for a best fit of free blocs first.
 
@@ -999,7 +1022,7 @@ r_re_alloc (ptr, size)
 
   if (!*ptr)
     return r_alloc (ptr, size);
-  if (!size) 
+  if (!size)
     {
       r_alloc_free (ptr);
       return r_alloc (ptr, 0);
@@ -1007,14 +1030,14 @@ r_re_alloc (ptr, size)
 
   bloc = find_bloc (ptr);
   if (bloc == NIL_BLOC)
-    abort ();
+    abort (); /* Already freed? PTR not originally used to allocate?  */
 
-  if (size < bloc->size) 
+  if (size < bloc->size)
     {
       /* Wouldn't it be useful to actually resize the bloc here?  */
       /* I think so too, but not if it's too expensive...  */
-      if ((bloc->size - MEM_ROUNDUP (size) >= page_size) 
-          && r_alloc_freeze_level == 0) 
+      if ((bloc->size - MEM_ROUNDUP (size) >= page_size)
+          && r_alloc_freeze_level == 0)
        {
          resize_bloc (bloc, MEM_ROUNDUP (size));
          /* Never mind if this fails, just do nothing...  */
@@ -1036,7 +1059,7 @@ r_re_alloc (ptr, size)
           else
            return NIL;
        }
-      else 
+      else
        {
          if (! resize_bloc (bloc, MEM_ROUNDUP (size)))
            return NIL;
@@ -1072,76 +1095,47 @@ void
 r_alloc_thaw ()
 {
 
-  if (! r_alloc_initialized) 
+  if (! r_alloc_initialized)
     r_alloc_init ();
 
   if (--r_alloc_freeze_level < 0)
     abort ();
 
-  /* This frees all unused blocs.  It is not too inefficient, as the resize 
-     and bcopy is done only once.  Afterwards, all unreferenced blocs are 
+  /* This frees all unused blocs.  It is not too inefficient, as the resize
+     and bcopy is done only once.  Afterwards, all unreferenced blocs are
      already shrunk to zero size.  */
-  if (!r_alloc_freeze_level) 
+  if (!r_alloc_freeze_level)
     {
       bloc_ptr *b = &first_bloc;
-      while (*b) 
-       if (!(*b)->variable) 
-         free_bloc (*b); 
-       else 
+      while (*b)
+       if (!(*b)->variable)
+         free_bloc (*b);
+       else
          b = &(*b)->next;
     }
 }
 
-\f
-/* The hook `malloc' uses for the function which gets more space
-   from the system.  */
-extern POINTER (*__morecore) ();
 
-/* Initialize various things for memory allocation.  */
+#if defined (emacs) && defined (DOUG_LEA_MALLOC)
 
-static void
-r_alloc_init ()
+/* Reinitialize the morecore hook variables after restarting a dumped
+   Emacs.  This is needed when using Doug Lea's malloc from GNU libc.  */
+void
+r_alloc_reinit ()
 {
-  if (r_alloc_initialized)
-    return;
-
-  r_alloc_initialized = 1;
-  real_morecore = __morecore;
-  __morecore = r_alloc_sbrk;
-
-  first_heap = last_heap = &heap_base;
-  first_heap->next = first_heap->prev = NIL_HEAP;
-  first_heap->start = first_heap->bloc_start
-    = virtual_break_value = break_value = (*real_morecore) (0);
-  if (break_value == NIL)
-    abort ();
-
-  page_size = PAGE;
-  extra_bytes = ROUNDUP (50000);
-
-  /* Give GNU malloc's morecore some hysteresis
-     so that we move all the relocatable blocks much less often.  */
-  __malloc_extra_blocks = 64;
+  /* Only do this if the hook has been reset, so that we don't get an
+     infinite loop, in case Emacs was linked statically.  */
+  if (__morecore != r_alloc_sbrk)
+    {
+      real_morecore = __morecore;
+      __morecore = r_alloc_sbrk;
+    }
+}
 
-  first_heap->end = (POINTER) ROUNDUP (first_heap->start);
+#endif /* emacs && DOUG_LEA_MALLOC */
 
-  /* The extra call to real_morecore guarantees that the end of the
-     address space is a multiple of page_size, even if page_size is
-     not really the page size of the system running the binary in
-     which page_size is stored.  This allows a binary to be built on a
-     system with one page size and run on a system with a smaller page
-     size.  */
-  (*real_morecore) (first_heap->end - first_heap->start);
-
-  /* Clear the rest of the last page; this memory is in our address space
-     even though it is after the sbrk value.  */
-  /* Doubly true, with the additional call that explicitly adds the
-     rest of that page to the address space.  */
-  bzero (first_heap->start, first_heap->end - first_heap->start);
-  virtual_break_value = break_value = first_heap->bloc_start = first_heap->end;
-  use_relocatable_buffers = 1;
-}
 #ifdef DEBUG
+
 #include <assert.h>
 
 void
@@ -1164,7 +1158,11 @@ r_alloc_check ()
     {
       assert (h->prev == ph);
       assert ((POINTER) ROUNDUP (h->end) == h->end);
+#if 0 /* ??? The code in ralloc.c does not really try to ensure
+        the heap start has any sort of alignment.
+        Perhaps it should.  */
       assert ((POINTER) MEM_ROUNDUP (h->start) == h->start);
+#endif
       assert ((POINTER) MEM_ROUNDUP (h->bloc_start) == h->bloc_start);
       assert (h->start <= h->bloc_start && h->bloc_start <= h->end);
 
@@ -1227,4 +1225,101 @@ r_alloc_check ()
   else
     assert (first_heap->bloc_start == break_value);
 }
+
 #endif /* DEBUG */
+
+/* Update the internal record of which variable points to some data to NEW.
+   Used by buffer-swap-text in Emacs to restore consistency after it
+   swaps the buffer text between two buffer objects.  The OLD pointer
+   is checked to ensure that memory corruption does not occur due to
+   misuse.  */
+void
+r_alloc_reset_variable (old, new)
+     POINTER *old, *new;
+{
+  bloc_ptr bloc = first_bloc;
+
+  /* Find the bloc that corresponds to the data pointed to by pointer.
+     find_bloc cannot be used, as it has internal consistency checks
+     which fail when the variable needs reseting.  */
+  while (bloc != NIL_BLOC)
+    {
+      if (bloc->data == *new)
+       break;
+
+      bloc = bloc->next;
+    }
+
+  if (bloc == NIL_BLOC || bloc->variable != old)
+    abort (); /* Already freed? OLD not originally used to allocate?  */
+
+  /* Update variable to point to the new location.  */
+  bloc->variable = new;
+}
+
+\f
+/***********************************************************************
+                           Initialization
+ ***********************************************************************/
+
+/* Initialize various things for memory allocation.  */
+
+static void
+r_alloc_init ()
+{
+  if (r_alloc_initialized)
+    return;
+  r_alloc_initialized = 1;
+
+  page_size = PAGE;
+#ifndef SYSTEM_MALLOC
+  real_morecore = __morecore;
+  __morecore = r_alloc_sbrk;
+
+  first_heap = last_heap = &heap_base;
+  first_heap->next = first_heap->prev = NIL_HEAP;
+  first_heap->start = first_heap->bloc_start
+    = virtual_break_value = break_value = (*real_morecore) (0);
+  if (break_value == NIL)
+    abort ();
+
+  extra_bytes = ROUNDUP (50000);
+#endif
+
+#ifdef DOUG_LEA_MALLOC
+  BLOCK_INPUT;
+  mallopt (M_TOP_PAD, 64 * 4096);
+  UNBLOCK_INPUT;
+#else
+#ifndef SYSTEM_MALLOC
+  /* Give GNU malloc's morecore some hysteresis
+     so that we move all the relocatable blocks much less often.  */
+  __malloc_extra_blocks = 64;
+#endif
+#endif
+
+#ifndef SYSTEM_MALLOC
+  first_heap->end = (POINTER) ROUNDUP (first_heap->start);
+
+  /* The extra call to real_morecore guarantees that the end of the
+     address space is a multiple of page_size, even if page_size is
+     not really the page size of the system running the binary in
+     which page_size is stored.  This allows a binary to be built on a
+     system with one page size and run on a system with a smaller page
+     size.  */
+  (*real_morecore) ((char *) first_heap->end - (char *) first_heap->start);
+
+  /* Clear the rest of the last page; this memory is in our address space
+     even though it is after the sbrk value.  */
+  /* Doubly true, with the additional call that explicitly adds the
+     rest of that page to the address space.  */
+  bzero (first_heap->start,
+        (char *) first_heap->end - (char *) first_heap->start);
+  virtual_break_value = break_value = first_heap->bloc_start = first_heap->end;
+#endif
+
+  use_relocatable_buffers = 1;
+}
+
+/* arch-tag: 6a524a15-faff-44c8-95d4-a5da6f55110f
+   (do not change this comment) */