From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24088 invoked by alias); 7 Apr 2011 12:16:43 -0000 Received: (qmail 24068 invoked by uid 22791); 7 Apr 2011 12:16:38 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 07 Apr 2011 12:16:32 +0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/48481] C++ overloading memory hog X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: memory-hog X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Thu, 07 Apr 2011 12:16:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-04/txt/msg00711.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48481 --- Comment #3 from Jakub Jelinek 2011-04-07 12:16:23 UTC --- Haven't bootstrapped/regtested it, but it is definitely improvement. With N=1000 and N=2000 the generated assembly is identical, for N=1000 reported TOTAL went down from 432768 kB to 89362 kB, for N=2000 from 1672544 kB to 298232 kB and on a box with 8GB of RAM I can compile even N=5000 case, which takes 1685817 kB reported TOTAL memory. N=10000 requires already too much RAM though. In the -DN=5000 -fmem-report dump the only interesting allocations are: cp/tree.c:1447 (ovl_cons) 1600160000:97.9% 0: 0.0% 1280032: 2.0% 0: 0.0% 50045001 Total 1634296366 38329920 65115511 11401989 51377483 source location Garbage Freed Leak Overhead Times so if even that garbage could be freed, this would be fixed completely. Even for N=1000 ovl_cons is the only one that really matters: cp/tree.c:1447 (ovl_cons) 64032000:90.2% 0: 0.0% 256032: 1.8% 0: 0.0% 2009001 Total 71012606 8986384 14294815 2724053 2289400 source location Garbage Freed Leak Overhead Times Those ovl_cons calls are from lookup_arg_dependent -> ... -> add_function -> build_overload. Is it guaranteed that perform_koenig_lookup, if it returns a chain of OVERLOADs, all OVERLOADs have been freshly make_noded and aren't shared with anything else? If yes, perhaps we could afterwards ggc_free the chain, or move it to some cache of OVERLOAD nodes and make ovl_cons start from that cache.