aboutsummaryrefslogtreecommitdiff
path: root/gcc/ggc-common.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2004-01-28 10:49:26 -0800
committerRichard Henderson <rth@gcc.gnu.org>2004-01-28 10:49:26 -0800
commit685fe0325cddc64776cc8e6c504ef40b35c846e0 (patch)
treeb2610d09544f2d611e1c960a1c767328e33944ed /gcc/ggc-common.c
parent42e5a9b95768990d55a44628a1faa1f7a3d0ab31 (diff)
downloadgcc-685fe0325cddc64776cc8e6c504ef40b35c846e0.zip
gcc-685fe0325cddc64776cc8e6c504ef40b35c846e0.tar.gz
gcc-685fe0325cddc64776cc8e6c504ef40b35c846e0.tar.bz2
ggc.h (ggc_free): Declare.
* ggc.h (ggc_free): Declare. * ggc-common.c (ggc_realloc): Use it. * ggc-page.c: Remove lots of inline markers. (globals): Add free_object_list. (ggc_alloc): Tidy. (ggc_free, validate_free_objects): New. (poison_pages): Provide default. (ggc_collect): Call validate_free_objects; emit markers to the debug file. From-SVN: r76801
Diffstat (limited to 'gcc/ggc-common.c')
-rw-r--r--gcc/ggc-common.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
index ecd6624..cf9bd00 100644
--- a/gcc/ggc-common.c
+++ b/gcc/ggc-common.c
@@ -147,6 +147,7 @@ ggc_realloc (void *x, size_t size)
return ggc_alloc (size);
old_size = ggc_get_size (x);
+
if (size <= old_size)
{
/* Mark the unwanted memory as unaccessible. We also need to make
@@ -176,7 +177,7 @@ ggc_realloc (void *x, size_t size)
memcpy (r, x, old_size);
/* The old object is not supposed to be used anymore. */
- VALGRIND_DISCARD (VALGRIND_MAKE_NOACCESS (x, old_size));
+ ggc_free (x);
return r;
}