summaryrefslogtreecommitdiff
path: root/libguile/gc-malloc.c
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2006-04-17 00:05:42 +0000
committerKevin Ryde <user42@zip.com.au>2006-04-17 00:05:42 +0000
commit2b829bbb3d685ff780a0e3c0888d1d1231e2bc0e (patch)
tree2fa96f40db1d02c513fa3002eb4819335cd194dd /libguile/gc-malloc.c
parentcd5fea8dbe4879f2d79aeef72f7385728db39d75 (diff)
downloadguile-2b829bbb3d685ff780a0e3c0888d1d1231e2bc0e.tar.gz
merge from 1.8 branch
Diffstat (limited to 'libguile/gc-malloc.c')
-rw-r--r--libguile/gc-malloc.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/libguile/gc-malloc.c b/libguile/gc-malloc.c
index ccdc58323..4c71be6b7 100644
--- a/libguile/gc-malloc.c
+++ b/libguile/gc-malloc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -185,6 +185,16 @@ static void
decrease_mtrigger (size_t size, const char * what)
{
scm_i_pthread_mutex_lock (&scm_i_gc_admin_mutex);
+
+ if (size > scm_mallocated)
+ {
+ fprintf (stderr, "`scm_mallocated' underflow. This means that more "
+ "memory was unregistered\n"
+ "via `scm_gc_unregister_collectable_memory ()' than "
+ "registered.\n");
+ abort ();
+ }
+
scm_mallocated -= size;
scm_gc_malloc_collected += size;
scm_i_pthread_mutex_unlock (&scm_i_gc_admin_mutex);