aboutsummaryrefslogtreecommitdiff
path: root/gcc/ggc-common.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2004-01-28 18:49:26 +0000
committerRichard Henderson <rth@redhat.com>2004-01-28 18:49:26 +0000
commit6c04f55fc0fedb8114a52cd13bcfa528eebc5043 (patch)
treeb2610d09544f2d611e1c960a1c767328e33944ed /gcc/ggc-common.c
parenta1e32837704c4f77142ad2b4ab8ba69f66f8b12a (diff)
* 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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@76801 138bc75d-0d04-0410-961f-82ee72b054a4
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 ecd6624487c..cf9bd005696 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;
}