summaryrefslogtreecommitdiff
path: root/gcc/ggc-common.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-28 18:49:26 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-28 18:49:26 +0000
commitc4e03242daf38c7a72c2882de2603909a42b81a0 (patch)
treeb2610d09544f2d611e1c960a1c767328e33944ed /gcc/ggc-common.c
parenta2e8135a41593b7e401eed06a9ec421a3e43dafb (diff)
downloadgcc-c4e03242daf38c7a72c2882de2603909a42b81a0.tar.gz
* 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: svn+ssh://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;
}