From c709de7f982ee19843e162f1778705a002c513c4 Mon Sep 17 00:00:00 2001 From: Mikael Djurfeldt Date: Thu, 21 Feb 2002 01:00:41 +0000 Subject: [PATCH] * gc.c (scm_gc_sweep): Print an error message when aborting due to underflowing scm_mallocated. --- libguile/ChangeLog | 5 +++++ libguile/gc.c | 20 +++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/libguile/ChangeLog b/libguile/ChangeLog index b46f0f98a..80943b34e 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,8 @@ +2002-02-20 Mikael Djurfeldt + + * gc.c (scm_gc_sweep): Print an error message when aborting due to + underflowing scm_mallocated. + 2002-02-14 Marius Vollmer * gc.h, gc.c (scm_must_malloc, scm_must_realloc, scm_must_strdup, diff --git a/libguile/gc.c b/libguile/gc.c index 82bc71e4e..3c901b0dd 100644 --- a/libguile/gc.c +++ b/libguile/gc.c @@ -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 * 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; if (scm_mallocated < m) - /* The byte count of allocated objects has underflowed. This is - probably because you forgot to report the sizes of objects you - have allocated, by calling scm_done_malloc or some such. When - the GC freed them, it subtracted their size from - scm_mallocated, which underflowed. */ - abort (); + { + /* The byte count of allocated objects has underflowed. This is + probably because you forgot to report the sizes of objects you + have allocated, by calling scm_done_malloc or some such. When + the GC freed them, it subtracted their size from + 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 (); + } scm_mallocated -= m; scm_gc_malloc_collected = m;