summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@lilypond.org>2008-08-16 15:20:55 -0300
committerHan-Wen Nienhuys <hanwen@lilypond.org>2008-08-16 15:20:55 -0300
commit676d9cc55311d9c44205423a794a026e98c35ee1 (patch)
treef8f396d4e665beb4abedc9973f8416b0d6c22412
parent40945e5e9f5b1ecbd9a5d9f8713e25898e056198 (diff)
downloadguile-676d9cc55311d9c44205423a794a026e98c35ee1.tar.gz
If realloc() fails in scm_realloc, then do a complete GC with complete
sweep directly.
-rw-r--r--libguile/gc-malloc.c22
-rw-r--r--libguile/gc.c2
2 files changed, 10 insertions, 14 deletions
diff --git a/libguile/gc-malloc.c b/libguile/gc-malloc.c
index 2dc9f0fc1..4e06f2f69 100644
--- a/libguile/gc-malloc.c
+++ b/libguile/gc-malloc.c
@@ -113,21 +113,17 @@ scm_realloc (void *mem, size_t size)
scm_i_scm_pthread_mutex_lock (&scm_i_sweep_mutex);
scm_gc_running_p = 1;
- // We don't want these sweep statistics to influence results for
- // cell GC, so we don't collect statistics.
- scm_i_sweep_all_segments ("realloc", NULL);
-
- SCM_SYSCALL (ptr = realloc (mem, size));
- if (ptr)
- {
- scm_gc_running_p = 0;
- scm_i_pthread_mutex_unlock (&scm_i_sweep_mutex);
- return ptr;
- }
-
scm_i_gc ("realloc");
+
+ /*
+ We don't want these sweep statistics to influence results for
+ cell GC, so we don't collect statistics.
+
+ realloc() failed, so we're really desparate to free memory. Run a
+ full sweep.
+ */
scm_i_sweep_all_segments ("realloc", NULL);
-
+
scm_gc_running_p = 0;
scm_i_pthread_mutex_unlock (&scm_i_sweep_mutex);
diff --git a/libguile/gc.c b/libguile/gc.c
index 95b3318cc..ce333305a 100644
--- a/libguile/gc.c
+++ b/libguile/gc.c
@@ -664,7 +664,7 @@ scm_i_gc (const char *what)
the time taken.
*/
scm_gc_time_taken += (scm_c_get_internal_run_time () - t_before_gc);
- assert(scm_cells_allocated == scm_i_marked_count ());
+
scm_i_thread_wake_up ();
/*
For debugging purposes, you could do