aboutsummaryrefslogtreecommitdiff
path: root/gcc/toplev.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2011-10-17 10:00:07 +0000
committerDodji Seketeli <dodji@redhat.com>2011-10-17 10:00:07 +0000
commit0b53f0b0d0ddcb4c87a89f2e7ad1b1f574944924 (patch)
tree0b0e309c095d0459230339edc0343cafe8f0c4c8 /gcc/toplev.c
parent07958d27f686904043d5cd8e3e44df5bc09f8e3f (diff)
Reduce memory waste due to non-power-of-2 allocs
This patch basically arranges for the allocation size of line_map buffers to be as close as possible to a power of two. This *significantly* decreases peak memory consumption as (macro) maps are numerous and stay live during all the compilation. The patch adds a new ggc_round_alloc_size interface to the ggc allocator. In each of the two main allocator implementations ('page' and 'zone') the function has been extracted from the main allocation function code and returns the actual size of the allocated memory region, thus giving a chance to the caller to maximize the amount of memory it actually uses from the allocated memory region. In the 'none' allocator implementation (that uses xmalloc) the ggc_round_alloc_size just returns the requested allocation size. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@180086 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r--gcc/toplev.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c
index f508196b3eb..86eed5d63a8 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1216,6 +1216,7 @@ general_init (const char *argv0)
line_table = ggc_alloc_line_maps ();
linemap_init (line_table);
line_table->reallocator = realloc_for_line_map;
+ line_table->round_alloc_size = ggc_round_alloc_size;
init_ttree ();
/* Initialize register usage now so switches may override. */