aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/malloc.goc
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/runtime/malloc.goc')
-rw-r--r--src/pkg/runtime/malloc.goc11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/pkg/runtime/malloc.goc b/src/pkg/runtime/malloc.goc
index 6371689a9c..6e1068d93d 100644
--- a/src/pkg/runtime/malloc.goc
+++ b/src/pkg/runtime/malloc.goc
@@ -849,16 +849,7 @@ runtime·cnewarray(Type *typ, intgo n)
}
func GC() {
- // We assume that the user expects unused memory to have
- // been freed when GC returns. To ensure this, run gc(1) twice.
- // The first will do a collection, and the second will force the
- // first's sweeping to finish before doing a second collection.
- // The second collection is overkill, but we assume the user
- // has a good reason for calling runtime.GC and can stand the
- // expense. At the least, this fixes all the calls to runtime.GC in
- // tests that expect finalizers to start running when GC returns.
- runtime·gc(1);
- runtime·gc(1);
+ runtime·gc(2); // force GC and do eager sweep
}
func SetFinalizer(obj Eface, finalizer Eface) {