mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 11:50:28 +02:00
If realloc() fails in scm_realloc, then do a complete GC with complete
sweep directly.
This commit is contained in:
parent
40945e5e9f
commit
676d9cc553
2 changed files with 10 additions and 14 deletions
|
@ -113,21 +113,17 @@ scm_realloc (void *mem, size_t size)
|
||||||
scm_i_scm_pthread_mutex_lock (&scm_i_sweep_mutex);
|
scm_i_scm_pthread_mutex_lock (&scm_i_sweep_mutex);
|
||||||
scm_gc_running_p = 1;
|
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");
|
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_i_sweep_all_segments ("realloc", NULL);
|
||||||
|
|
||||||
scm_gc_running_p = 0;
|
scm_gc_running_p = 0;
|
||||||
scm_i_pthread_mutex_unlock (&scm_i_sweep_mutex);
|
scm_i_pthread_mutex_unlock (&scm_i_sweep_mutex);
|
||||||
|
|
||||||
|
|
|
@ -664,7 +664,7 @@ scm_i_gc (const char *what)
|
||||||
the time taken.
|
the time taken.
|
||||||
*/
|
*/
|
||||||
scm_gc_time_taken += (scm_c_get_internal_run_time () - t_before_gc);
|
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 ();
|
scm_i_thread_wake_up ();
|
||||||
/*
|
/*
|
||||||
For debugging purposes, you could do
|
For debugging purposes, you could do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue