|
From: <sv...@va...> - 2005-09-20 12:48:53
|
Author: sewardj
Date: 2005-09-20 13:48:45 +0100 (Tue, 20 Sep 2005)
New Revision: 4700
Log:
Reinstate garbage collection of string table slots.
Modified:
branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c
Modified: branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c 2005-09-20 12:07:1=
4 UTC (rev 4699)
+++ branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c 2005-09-20 12:48:4=
5 UTC (rev 4700)
@@ -755,7 +755,7 @@
=20
static Bool preen_nsegments ( void )
{
- Int i, r, w, nsegments_used_old =3D nsegments_used;
+ Int i, j, r, w, nsegments_used_old =3D nsegments_used;
=20
/* Pass 1: check the segment array covers the entire address space
exactly once, and also that each segment is sane. */
@@ -785,6 +785,27 @@
aspacem_assert(w > 0 && w <=3D nsegments_used);
nsegments_used =3D w;
=20
+ /* Pass 3: free up unused string table slots */
+ /* clear mark bits */
+ for (i =3D 0; i < segnames_used; i++)
+ segnames[i].mark =3D False;
+ /* mark */
+ for (i =3D 0; i < nsegments_used; i++) {
+ j =3D nsegments[i].fnIdx;
+ aspacem_assert(j >=3D -1 && j < segnames_used);
+ if (j >=3D 0) {
+ aspacem_assert(segnames[j].inUse);
+ segnames[j].mark =3D True;
+ }
+ }
+ /* release */
+ for (i =3D 0; i < segnames_used; i++) {
+ if (segnames[i].mark =3D=3D False) {
+ segnames[i].inUse =3D False;
+ segnames[i].fname[0] =3D 0;
+ }
+ }
+
return nsegments_used !=3D nsegments_used_old;
}
=20
|