Commit f74458a7 authored by sof's avatar sof

[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()
parent 9d431e08
/* -----------------------------------------------------------------------------
* $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
*
......@@ -108,18 +108,6 @@ stgReallocBytes (void *p, int n, char *msg)
return space;
}
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)
{
......
/* -----------------------------------------------------------------------------
* $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);
......
/* -----------------------------------------------------------------------------
* $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);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment