public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "mikael at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/108925] memory leak of gfc_get_namespace result Date: Tue, 07 Mar 2023 11:41:12 +0000 [thread overview] Message-ID: <bug-108925-4-QjH0uySKXV@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-108925-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108925 --- Comment #6 from Mikael Morin <mikael at gcc dot gnu.org> --- Created attachment 54598 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54598&action=edit Tentative patch Indeed the namespaces created during module loading are not stored anywhere, so they are leaked basically. As they are the pieces holding symbols, which themselves hold other things, etc, all these are leaked as well. The attached patch stores in the current namespace a tree of module namespaces, and use those namespaces when loading a symbol from a module. For a symbol that is present in a module, this means that its sym->ns will be the module namespace, even if its sym->ns was not the module namespace at the time it was written. This makes a difference for symbols that are present in more than one namespace, but I'm not sure how important that difference is. This seems to work on the reduced testcases, can't fully test right now.
next prev parent reply other threads:[~2023-03-07 11:41 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-02-24 12:32 [Bug fortran/108925] New: " rguenth at gcc dot gnu.org 2023-03-06 19:23 ` [Bug fortran/108925] " mikael at gcc dot gnu.org 2023-03-06 19:40 ` anlauf at gcc dot gnu.org 2023-03-06 19:47 ` mikael at gcc dot gnu.org 2023-03-06 19:52 ` anlauf at gcc dot gnu.org 2023-03-06 20:00 ` mikael at gcc dot gnu.org 2023-03-07 11:41 ` mikael at gcc dot gnu.org [this message] 2023-03-08 19:52 ` anlauf at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-108925-4-QjH0uySKXV@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).