From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb2a.google.com (mail-yb1-xb2a.google.com [IPv6:2607:f8b0:4864:20::b2a]) by sourceware.org (Postfix) with ESMTPS id 6DA0D3858D28 for ; Sat, 18 Dec 2021 13:58:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6DA0D3858D28 Received: by mail-yb1-xb2a.google.com with SMTP id d10so14742085ybn.0 for ; Sat, 18 Dec 2021 05:58:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=RkZzflLJZ44BBAk2s7aqaXVqIHGs15k0nnIgZrsCKfU=; b=Smesnqmrqg+1FBHinNqRUsM3hT53YWPiw4a5Iw+XECVsH+W4BceiJHT7/yjTxk11o4 SG9FQkGWpSazG2x0W2ujFtMqYFJYqAPD/a7PFIvQkIR0HWDlbXq6tfnBiLOruSDl/qif DdQP3XK9tuyZS/WXW1x8P1UqzWjZ02CvCubaHbGeGNQ7yAev4UBYBKtuu4hxykMR9MDH f/NjMGUm6++IxYBFHddLiqveYTzARnuaJXwS5At8mTt+qyc/ArctQWJ6hagkcSs1zjSN /3AGrA0D2ibPFZ0/Fdz02P0EMtBca9i77HikNiXz+gAo6PHf1Gb2fWvt0Efu4ZKJcx9R CQTQ== X-Gm-Message-State: AOAM5332y2kNZfZjNTRZkANzgEauZYemtmSJQQh2HebeRqKWCCLy7Jex 7qjwqYPCunM7pw5gOlCfexIrFURB+F1NPX/HIXU= X-Google-Smtp-Source: ABdhPJwHSxBxLnbVbg5gbOouEGNYABMPh1cO3AO/hMPXqhvZ/shKkg+DqIsK59NpAOPv5uRBo/cj5cuFEybW61MuaM0= X-Received: by 2002:a25:dad4:: with SMTP id n203mr10319330ybf.554.1639835883840; Sat, 18 Dec 2021 05:58:03 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: =?UTF-8?Q?Marc_Nieper=2DWi=C3=9Fkirchen?= Date: Sat, 18 Dec 2021 14:57:51 +0100 Message-ID: Subject: Re: Memory leaks (detected by Valgrind) To: David Malcolm Cc: Alex Coplan , =?UTF-8?Q?Marc_Nieper=2DWi=C3=9Fkirchen?= , Mark Wielaard , "jit@gcc.gnu.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: jit@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Jit mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Dec 2021 13:58:05 -0000 Am Sa., 18. Dez. 2021 um 00:23 Uhr schrieb David Malcolm : > > On Fri, 2021-12-17 at 10:52 +0000, Alex Coplan via Jit wrote: > > Hi, > > > > > -----Original Message----- > > > From: Jit On Behalf > > > Of Marc > > > Nieper-Wi=C3=9Fkirchen via Jit > > > Sent: 17 December 2021 10:29 > > > To: Mark Wielaard > > > Cc: Marc Nieper-Wi=C3=9Fkirchen ; > > > jit@gcc.gnu.org > > > Subject: Re: Memory leaks (detected by Valgrind) > > > > > > Thanks! > > > > > > With `--enable-valgrind-annotations`, the "uses of uninitialized > > > values" > > > have gone away, but a lot of small leaks are still present: > > > > Memory leaks with libgccjit are a known issue, see > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D63854 > > FWIW, it looks like all of the remaining leaks are in gcc.c (the > "driver" code, for the "gcc" binary). IIRC most of this relates to > long-standing code that was written with the assumption that it will > only be run once and not persist in memory, and so it tends to mix up > string literals and dynamically-allocated strings without bothering to > free them (the pointer values persist to the end of "main" when run > from gcc, but get cleared when run from libgccjit.so). > > Patches to clean these up would be great. That said, I'm not the > driver/gcc.c maintainer, so I can't formally approve them (but can post > +1 emails if they look good to me) [1] I am currently trying to find my way through the code in gcc.c. During my experiments, I fixed a single leak where a dynamically allocated string was assigned in place of a statically allocated one by moving the dynamically allocated string onto the obstack. I hope that such an approach is acceptable. > > Dave > [1] also, I'm on vacation, so sorry in advance for any slow responses > to email. I wish you a good time on your vacation! [...]