From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by sourceware.org (Postfix) with ESMTPS id 330EF3A7642C for ; Wed, 28 Apr 2021 16:07:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 330EF3A7642C Received: by mail-pl1-x633.google.com with SMTP id h7so4542485plt.1 for ; Wed, 28 Apr 2021 09:07:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=G1EbXYu5am4GqIKfJHTTgYTUPx/AYGr5T/JLdoWTYNM=; b=tI/wRp7c8AD4cfY9lB3n8iLyAe15oOvhLXoQs83C+UAHDsvEXuZtA5SBvNbWNrej9y OgZgjPou3qHP0J1+M6xnaNh2hRFgI1ig3EHk0X8yEGpCGWekBh6gN0UCpa7T+rIh+Awa m3DFnyan95hcqq4MnowGNI2ncNn6+f8K3LHrE6Th3tk6Ny0zE8G52ZBkehPfY1fex5KV EW++H/kNReex9Cz367LYqqZoky1GvBKWlv3tnMioX4B3aneie2suMg3xU+7fAO726967 7hfEsKI4OKzN+9p3EpxTLnGn05G1B3T2svTuUGLxcQ6s3GlL0zTogJfOrmkoz2bcgFoG R4ww== X-Gm-Message-State: AOAM531CYvTwYyEdZ53XckE6Z0fAwrMviHn1c4Ged2+ns60+pf8UCDHg Dhz+MlHpNL2wvmmCmFOIXsnWrRNMkVAgrw== X-Google-Smtp-Source: ABdhPJxJAZ9XHnztTmqcJeTfVhl7zbaBjEUZS3/YCOSrjBYfcHFcttRNzHBcABWHAjSE7o4i65JCjQ== X-Received: by 2002:a17:903:3106:b029:e9:15e8:250e with SMTP id w6-20020a1709033106b02900e915e8250emr31075548plc.33.1619626037198; Wed, 28 Apr 2021 09:07:17 -0700 (PDT) Received: from [192.168.1.29] (65-130-82-141.slkc.qwest.net. [65.130.82.141]) by smtp.gmail.com with ESMTPSA id w123sm162938pfb.109.2021.04.28.09.07.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Apr 2021 09:07:16 -0700 (PDT) Subject: Re: [PATCH v2 18/21] libcc1: fix a memory leak To: Tom Tromey , gcc-patches@gcc.gnu.org References: <20210428010119.806184-1-tom@tromey.com> <20210428010119.806184-19-tom@tromey.com> From: Jeff Law Message-ID: <0f0130e0-6947-dd20-ae88-a0731a0860c2@gmail.com> Date: Wed, 28 Apr 2021 10:07:16 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: <20210428010119.806184-19-tom@tromey.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_CSS, URIBL_CSS_A autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Apr 2021 16:07:19 -0000 On 4/27/2021 7:01 PM, Tom Tromey wrote: > libcc1 has a memory leak when calling fork_exec -- it allocates a new > vector of arguments, but then does not free it anywhere. This patch > changes this code to use std::vector instead. > > Note that the previous code tried to avoid bad_alloc. I don't believe > this is very important. For one thing, plenty of other allocations do > not bother with this. > > libcc1/ChangeLog > 2021-04-27 Tom Tromey > > * gdbctx.hh (do_compile): Use std::vector. OK jeff