summaryrefslogtreecommitdiff
path: root/gcc/ggc-page.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-28 06:05:53 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-28 06:05:53 +0000
commit8171e6757ac8792ad21c9e51bd572c50440463ee (patch)
tree5580dcc183ad9c8931308296e2c2f1646ee368b2 /gcc/ggc-page.c
parent4b722a2f93532df6057a3c9309f9209bd7711b57 (diff)
downloadgcc-8171e6757ac8792ad21c9e51bd572c50440463ee.tar.gz
* ggc-page.c (GGC_MIN_LAST_ALLOCATED): New.
(init_ggc): Use it instead of a constant. (ggc_collect): Bound allocated_last_gc by it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29685 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ggc-page.c')
-rw-r--r--gcc/ggc-page.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c
index b5a28990e42..54528a5f3a0 100644
--- a/gcc/ggc-page.c
+++ b/gcc/ggc-page.c
@@ -255,6 +255,10 @@ static struct globals
one) before collection is performed. */
#define GGC_MIN_EXPAND_FOR_GC (1.3)
+/* Bound `allocated_last_gc' to 4MB, to prevent the memory expansion
+ test from triggering too often when the heap is small. */
+#define GGC_MIN_LAST_ALLOCATED (4 * 1024 * 1024)
+
static page_entry *lookup_page_table_entry PROTO ((void *));
static void set_page_table_entry PROTO ((void *, page_entry *));
@@ -724,9 +728,7 @@ init_ggc ()
G.debug_file = stdout;
#endif
- /* Set the initial allocation to 4MB, so no collection will be
- performed until the heap is somewhat larger than 4 MB. */
- G.allocated_last_gc = 4 * 1024 * 1024;
+ G.allocated_last_gc = GGC_MIN_LAST_ALLOCATED;
empty_string = ggc_alloc_string ("", 0);
ggc_add_string_root (&empty_string, 1);
@@ -1034,6 +1036,8 @@ ggc_collect ()
#endif
G.allocated_last_gc = G.allocated;
+ if (G.allocated_last_gc < GGC_MIN_LAST_ALLOCATED)
+ G.allocated_last_gc = GGC_MIN_LAST_ALLOCATED;
time = get_run_time () - time;
gc_time += time;