From: sof Date: Mon, 31 Mar 2003 19:19:34 +0000 (+0000) Subject: [project @ 2003-03-31 19:19:34 by sof] X-Git-Tag: Approx_11550_changesets_converted~1000 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=f74458a707d766e7b9b04db7d27cb3f697100e4f;p=ghc-hetmet.git [project @ 2003-03-31 19:19:34 by sof] - Stable.c:enlargeStablePtrTable(): plug a mem leak, the (re-)allocation is in bytes, not words. - nuke RtsUtils.c:stgMallocWords(), RtsUtils.c:stgReallocWords() --- diff --git a/ghc/rts/RtsUtils.c b/ghc/rts/RtsUtils.c index e741ffb..5817a95 100644 --- a/ghc/rts/RtsUtils.c +++ b/ghc/rts/RtsUtils.c @@ -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; diff --git a/ghc/rts/RtsUtils.h b/ghc/rts/RtsUtils.h index bada4b6..7b38afb 100644 --- a/ghc/rts/RtsUtils.h +++ b/ghc/rts/RtsUtils.h @@ -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); diff --git a/ghc/rts/Stable.c b/ghc/rts/Stable.c index e9c6181..72b3a98 100644 --- a/ghc/rts/Stable.c +++ b/ghc/rts/Stable.c @@ -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); } }