summaryrefslogtreecommitdiff
path: root/gcc/ggc-common.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-26 22:57:19 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-26 22:57:19 +0000
commitbaca0a47b830387e22f0518632f1207f5a0fb1a5 (patch)
tree6ad2a5fec27d82b846c6968e407efd9ffcd30d66 /gcc/ggc-common.c
parent75a661c275a875562b01fc6ec9bf375c0c9bc4d8 (diff)
downloadgcc-baca0a47b830387e22f0518632f1207f5a0fb1a5.tar.gz
* c-parse.in (extension): Use itype.
(SAVE_EXT_FLAGS): Don't allocate a tree. (RESTORE_EXT_FLAGS): Don't read a tree. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@76674 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ggc-common.c')
-rw-r--r--gcc/ggc-common.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
index ecd6624487c..6ec7db7f264 100644
--- a/gcc/ggc-common.c
+++ b/gcc/ggc-common.c
@@ -147,6 +147,11 @@ ggc_realloc (void *x, size_t size)
return ggc_alloc (size);
old_size = ggc_get_size (x);
+
+#ifndef ENABLE_GC_ALWAYS_COLLECT
+ /* In completely-anal-checking mode, never re-use memory. This maximizes
+ the chance of catching the user retaining a pointer to the old block.
+ Otherwise, we get to consume the power-of-two overhead we had before. */
if (size <= old_size)
{
/* Mark the unwanted memory as unaccessible. We also need to make
@@ -164,6 +169,7 @@ ggc_realloc (void *x, size_t size)
VALGRIND_DISCARD (VALGRIND_MAKE_READABLE (x, size));
return x;
}
+#endif
r = ggc_alloc (size);
@@ -176,7 +182,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;
}