]> git.ipfire.org Git - thirdparty/gcc.git/commit
Do not allocate huge array in output_in_order.
authorMartin Liska <mliska@suse.cz>
Thu, 30 Jul 2020 07:24:40 +0000 (09:24 +0200)
committerMartin Liska <mliska@suse.cz>
Fri, 31 Jul 2020 10:47:58 +0000 (12:47 +0200)
commit44d662cf6d9a974ef972d518507c9c52acf38e55
tree49ed06d42baa35cff9e1f2dad81e8d394c9c2c34
parente7d6233a82859b362252b87c62762970a009cc26
Do not allocate huge array in output_in_order.

We noticed that when analyzing LTRANS memory peak that happens right
after the start:
https://gist.github.com/marxin/223890df4d8d8e490b6b2918b77dacad

In case of chrome, we have symtab->order == 200M, so we allocate
16B * 200M = 3.2GB.

gcc/ChangeLog:

* cgraph.h: Remove leading empty lines.
* cgraphunit.c (enum cgraph_order_sort_kind): Remove
ORDER_UNDEFINED.
(struct cgraph_order_sort): Add constructors.
(cgraph_order_sort::process): New.
(cgraph_order_cmp): New.
(output_in_order): Simplify and push nodes to vector.

(cherry picked from commit 8bd062e8ad44e70be04108232e1ef597fc3b3e3e)
gcc/cgraph.h
gcc/cgraphunit.c