From: Simon Marchi <simon.marchi@polymtl.ca>
To: gdb-patches@sourceware.org
Subject: Re: [PATCH] sim/m32c: fix memory leaks in opc2c
Date: Mon, 5 Apr 2021 14:46:37 -0400 [thread overview]
Message-ID: <e8c5ee33-fe84-e258-9bff-b558c7d88ad5@polymtl.ca> (raw)
In-Reply-To: <YGs5m0s56TAqdT01@vapier>
On 2021-04-05 12:23 p.m., Mike Frysinger wrote:> On 05 Apr 2021 10:58, Simon Marchi via Gdb-patches wrote:
>> Fix the leak in dump_lines by free-ing the elements of varnames.
>
> i dislike stuffing a bunch of free's at the end of a program's lifetime just
> to satisfy a tool that is not normally used. which isn't to say LSAN isn't
> useful, just that i think we should do better.
Why though? Because it adds execution time where not necessary?
> in other codebases, i've done things like:
> #ifdef __SANITIZE_ADDRESS__
> # define ENABLE_CLEANUP_ONEXIT 1
> #else
> # define ENABLE_CLEANUP_ONEXIT 0
> #endif
>
> then this could be written:
>
> if (ENABLE_CLEANUP_ONEXIT) {
> for (i = 0; i < vn; i++)
> free (varnames[i]);
> }
>
> wdyt ? feel free to bikeshed the name. not sure if there's prior art in
> the tree currently.
I find this complexity a bit unnecessary, versus just free-ing the
stuff. But I don't really mind, we can do as you like, I just want to
my build to be fixed!
Note that the igen tool doesn't free anything, so it's next on the list
of things that break the -fsanizite=address build. I started to update
it to free things, it's a bit tedious but it should be do-able.
Another option would be to change the Makefile to call igen with the
ASAN_OPTIONS=detect_leaks=0 environment variable.
Simon
next prev parent reply other threads:[~2021-04-05 18:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-05 14:58 Simon Marchi
2021-04-05 16:23 ` Mike Frysinger
2021-04-05 18:46 ` Simon Marchi [this message]
2021-04-05 21:51 ` Mike Frysinger
2021-04-06 1:36 ` Simon Marchi
2021-04-06 10:41 ` Mike Frysinger
2021-04-06 13:28 ` Simon Marchi
2021-04-06 13:45 ` Tom Tromey
2021-04-06 18:01 ` Philippe Waroquiers
2021-04-06 22:45 ` Mike Frysinger
2021-04-07 1:45 ` Simon Marchi
2021-04-07 11:38 ` Mike Frysinger
2021-04-07 14:19 ` Simon Marchi
2021-04-08 4:51 ` Mike Frysinger
2021-04-08 13:52 ` Simon Marchi
2021-04-08 4:50 ` Mike Frysinger
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=e8c5ee33-fe84-e258-9bff-b558c7d88ad5@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=gdb-patches@sourceware.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: link
Be 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).