From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 30DD439AE425 for ; Thu, 19 Aug 2021 18:00:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 30DD439AE425 Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-359-Yh_pL_mGPYOc2R_osBo7iQ-1; Thu, 19 Aug 2021 14:00:53 -0400 X-MC-Unique: Yh_pL_mGPYOc2R_osBo7iQ-1 Received: by mail-qv1-f70.google.com with SMTP id ay14-20020a056214048eb0290357469934easo5071496qvb.8 for ; Thu, 19 Aug 2021 11:00:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=XrdSGP7TXU5s1WhyErHm3eRFxQ7VkT5djSUh+u3DBXM=; b=DR2ldQBD+POofr5NN1zjjkG8MwpM++vuQY99apYRTYrSTT2Dl9PjWI+S2zEYse7MHJ i3NeZ/xDXRRfwe45FMW/Abx2r8dTr85vsBfs3E3enS4ZvOjzhI9LncmTStIshmadQAAw 7ZXx0N2u20q9sW1yo7LBDL4GkS7GCycfBjCgknQXVJdso2TMKPJyyIsnlF5MSSA3tS0m lsTu317Hb/FXM9+CgS29/VUA9WO1BBT9NT8NZbVcOfUD8GmPXGwlI28SGx+Xq2bz+cQQ P1KCpi4aU1BkcSmKN6tPAjMVfJ+wOFkT2kXdqsuru5YPJJtdtylT2UC4WpEQFVqzaebS WMjw== X-Gm-Message-State: AOAM53095VElUNCI6qu5OWogm+3Wm1mbEK8V0bLX7KjlWuZSnuVt1GHy kQtjS0Urrvg6zqQ8nHDH7OQOoNAGrQ3hwSGGZakNJorIFUrJ69qHOEoNZ8SlT6MBBNIL2pU+5cR QflGzwix1X/HNVRbCeA== X-Received: by 2002:a37:a48d:: with SMTP id n135mr4936976qke.54.1629396053278; Thu, 19 Aug 2021 11:00:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxd0CYQX9ZPY7RmEHb63xi19msktO6Ech+F6h89LY2rYUZthLzDJGRbHtaEFTdbwFZu/k0rTw== X-Received: by 2002:a37:a48d:: with SMTP id n135mr4936952qke.54.1629396053069; Thu, 19 Aug 2021 11:00:53 -0700 (PDT) Received: from t14s.localdomain (c-73-69-212-193.hsd1.nh.comcast.net. [73.69.212.193]) by smtp.gmail.com with ESMTPSA id h140sm1987798qke.112.2021.08.19.11.00.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 11:00:52 -0700 (PDT) Message-ID: <976620a4322632483e4d695587ce02df89bf39af.camel@redhat.com> Subject: Re: [PATCH] document enable/disable_ranger From: David Malcolm To: Martin Sebor , Aldy Hernandez , Andrew MacLeod , gcc-patches Date: Thu, 19 Aug 2021 14:00:51 -0400 In-Reply-To: <3f7e872f-f9e6-aa26-a028-a0c883bebed5@gmail.com> References: <3f7e872f-f9e6-aa26-a028-a0c883bebed5@gmail.com> User-Agent: Evolution 3.38.4 (3.38.4-1.fc33) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, 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: 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: Thu, 19 Aug 2021 18:00:56 -0000 On Thu, 2021-08-19 at 11:30 -0600, Martin Sebor via Gcc-patches wrote: > Hey Aldy & Andrew, > > I introduced a leak by calling enable_ranger() without pairing it > with one to disable_ranger() on the same function (PR 101984). > I didn't realize (or look to see) that enable_ranger() dynamically > allocates memory. > > The patch below adds comments to make it clear that the calls need > to be paired.  That seems obvious now but wasn't before from just > the function names.  So I'm wondering if we might want to rename > them to make it more obvious that the former involves allocating > memory that must be explicitly deallocated. > > If you agree, names along the following lines would make this > clearer (to me, anyway) but I'm open to others: > >    gimple_ranger *set_new_ranger (function *); >    void release_ranger (function *); Could an RAII class help here, to make the aquire/release pairing more automatic? Dave