1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 21:40:33 +02:00

* gc.c (scm_gc_sweep): Print an error message when aborting due to

underflowing scm_mallocated.
This commit is contained in:
Mikael Djurfeldt 2002-02-21 01:00:41 +00:00
parent b30366b6b9
commit c709de7f98
2 changed files with 18 additions and 7 deletions

View file

@ -1,3 +1,8 @@
2002-02-20 Mikael Djurfeldt <mdj@linnaeus>
* gc.c (scm_gc_sweep): Print an error message when aborting due to
underflowing scm_mallocated.
2002-02-14 Marius Vollmer <marius.vollmer@uni-dortmund.de> 2002-02-14 Marius Vollmer <marius.vollmer@uni-dortmund.de>
* gc.h, gc.c (scm_must_malloc, scm_must_realloc, scm_must_strdup, * gc.h, gc.c (scm_must_malloc, scm_must_realloc, scm_must_strdup,

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. /* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002 Free Software Foundation, Inc.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -1833,12 +1833,18 @@ scm_gc_sweep ()
scm_gc_yield -= scm_cells_allocated; scm_gc_yield -= scm_cells_allocated;
if (scm_mallocated < m) if (scm_mallocated < m)
{
/* The byte count of allocated objects has underflowed. This is /* The byte count of allocated objects has underflowed. This is
probably because you forgot to report the sizes of objects you probably because you forgot to report the sizes of objects you
have allocated, by calling scm_done_malloc or some such. When have allocated, by calling scm_done_malloc or some such. When
the GC freed them, it subtracted their size from the GC freed them, it subtracted their size from
scm_mallocated, which underflowed. */ scm_mallocated, which underflowed. */
fprintf (stderr,
"scm_gc_sweep: Byte count of allocated objects has underflowed.\n"
"This is probably because the GC hasn't been correctly informed\n"
"about object sizes\n");
abort (); abort ();
}
scm_mallocated -= m; scm_mallocated -= m;
scm_gc_malloc_collected = m; scm_gc_malloc_collected = m;