[project @ 2003-03-31 19:19:34 by sof]
authorsof <unknown>
Mon, 31 Mar 2003 19:19:34 +0000 (19:19 +0000)
committersof <unknown>
Mon, 31 Mar 2003 19:19:34 +0000 (19:19 +0000)
- Stable.c:enlargeStablePtrTable(): plug a mem leak,
  the (re-)allocation is in bytes, not words.
- nuke RtsUtils.c:stgMallocWords(),
       RtsUtils.c:stgReallocWords()

ghc/rts/RtsUtils.c
ghc/rts/RtsUtils.h
ghc/rts/Stable.c

index e741ffb..5817a95 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: RtsUtils.c,v 1.32 2003/03/25 17:58:49 sof Exp $
+ * $Id: RtsUtils.c,v 1.33 2003/03/31 19:19:34 sof Exp $
  *
  * (c) The GHC Team, 1998-2002
  *
@@ -109,18 +109,6 @@ stgReallocBytes (void *p, int n, char *msg)
 }
 
 void *
-stgMallocWords (int n, char *msg)
-{
-  return(stgMallocBytes(n * sizeof(W_), msg));
-}
-
-void *
-stgReallocWords (void *p, int n, char *msg)
-{
-  return(stgReallocBytes(p, n * sizeof(W_), msg));
-}
-
-void *
 stgCallocBytes (int n, int m, char *msg)
 {
   int   i;
index bada4b6..7b38afb 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: RtsUtils.h,v 1.15 2003/03/25 17:58:50 sof Exp $
+ * $Id: RtsUtils.h,v 1.16 2003/03/31 19:19:34 sof Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -7,10 +7,9 @@
  *
  * ---------------------------------------------------------------------------*/
 
+/* (Checked) dynamic allocation: */
 extern void *stgMallocBytes(int n, char *msg);
-extern void *stgMallocWords(int n, char *msg);
 extern void *stgReallocBytes(void *p, int n, char *msg);
-extern void *stgReallocWords(void *p, int n, char *msg);
 extern void *stgCallocBytes(int n, int m, char *msg);
 extern void stgFree(void* p);
 
index e9c6181..72b3a98 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Stable.c,v 1.24 2003/01/28 17:05:43 simonmar Exp $
+ * $Id: Stable.c,v 1.25 2003/03/31 19:19:34 sof Exp $
  *
  * (c) The GHC Team, 1998-2002
  *
@@ -258,8 +258,8 @@ enlargeStablePtrTable(void)
   if (SPT_size == 0) {
     // 1st time
     SPT_size = INIT_SPT_SIZE;
-    stable_ptr_table = stgMallocWords(SPT_size * sizeof(snEntry), 
-                                     "initStablePtrTable");
+    stable_ptr_table = stgMallocBytes(SPT_size * sizeof(snEntry), 
+                                     "enlargeStablePtrTable");
     
     /* we don't use index 0 in the stable name table, because that
      * would conflict with the hash table lookup operations which
@@ -272,9 +272,10 @@ enlargeStablePtrTable(void)
     // 2nd and subsequent times
     SPT_size *= 2;
     stable_ptr_table = 
-      stgReallocWords(stable_ptr_table, SPT_size * sizeof(snEntry),
+      stgReallocBytes(stable_ptr_table, 
+                     SPT_size * sizeof(snEntry),
                      "enlargeStablePtrTable");
-    
+
     initFreeList(stable_ptr_table + old_SPT_size, old_SPT_size, NULL);
   }
 }