Next problem with 0.8.4 in gc-malloc.c
Bernie Solomon
bernard at UG.EDS.COM
Mon Apr 21 08:57:53 PDT 1997
Having got past the previous problem I then fell over the fact that the
new malloc package didn't terminate its free list of blocks with NULL
correctly. No doubt this code was adapted from something that really did
go sbrk in which case the new memory would no doubt have been zero but
this is on top of plain malloc. I also noticed findbucket was never
called in this adaption so I've removed it:
sdlhpp5% diff -c ~/orig-kaffe-0.8.4/kaffe/kaffevm/gc-malloc.c
master/kaffe/kaffevm
*** /users/bernard/orig-kaffe-0.8.4/kaffe/kaffevm/gc-malloc.c Fri Apr
18 15:58:33 1997
--- master/kaffe/kaffevm/gc-malloc.c Mon Apr 21 16:50:40 1997
***************
*** 62,68 ****
#endif
static void morecore();
- static int findbucket();
/*
* The overhead on a block is at least 4 bytes. When free, this space
--- 62,67 ----
***************
*** 298,303 ****
--- 297,303 ----
op->ov_next = (union overhead *)((caddr_t)op + sz);
op = (union overhead *)((caddr_t)op + sz);
}
+ op->ov_next = NULL;
}
void
***************
*** 326,353 ****
#ifdef MSTATS
nmalloc[size]--;
#endif
- }
-
- /*
- * Search ``srchlen'' elements of each free list for a block whose
- * header starts at ``freep''. If srchlen is -1 search the whole
list.
- * Return bucket number, or -1 if not found.
- */
- static
- findbucket(union overhead* freep, int srchlen)
- {
- register union overhead *p;
- register int i, j;
-
- for (i = 0; i < NBUCKETS; i++) {
- j = 0;
- for (p = nextf[i]; p && j != srchlen; p = p->ov_next) {
- if (p == freep)
- return (i);
- j++;
- }
- }
- return (-1);
}
#ifdef MSTATS
--- 326,331 ----
--
Bernie Solomon (bernard at edsug.com or Bernard.Solomon at acm.org)
Unigraphics Architecture, EDS-Unigraphics, Cambridge, UK
More information about the kaffe
mailing list