From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 93344 invoked by alias); 5 Dec 2019 16:44:15 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 93336 invoked by uid 89); 5 Dec 2019 16:44:15 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-4.3 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy=U*philippe.waroquiers, D*skynet.be, philippe.waroquiers@skynet.be, D*be X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-2.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (207.211.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 05 Dec 2019 16:44:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575564252; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OxV62miID5pQ7IwqkuEYJjjy3m7SSAHAN+HTXvRS9qg=; b=YvTwcn8s1u8eTHu3/xX0jP+0s04c6tdhIhbgwjhPfgL2Wnylbh+d6Pt/n2HBmWHEFZw5CR ulrMmTo+w6Az/+8CskJ9XJNuEQMEOQ9Lxr5fnwdyuaL2Zuy/VL9p97uEukFdT43M5wVonD a/GfMjY58PkhYjEv5GUxWTYCq8UEOp4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-413-MFXxFDDuPDWOjCwWH9OJQQ-1; Thu, 05 Dec 2019 11:44:07 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 60D1A10ABCF1; Thu, 5 Dec 2019 16:44:06 +0000 (UTC) Received: from f31-4.lan (ovpn-116-54.phx2.redhat.com [10.3.116.54]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 319C95D6A5; Thu, 5 Dec 2019 16:44:06 +0000 (UTC) Date: Thu, 05 Dec 2019 16:44:00 -0000 From: Kevin Buettner To: gdb-patches@sourceware.org Cc: Philippe Waroquiers Subject: Re: [RFA] Fix leaks when pruning inferiors. Message-ID: <20191205094404.5490aae6@f31-4.lan> In-Reply-To: <20191201155220.15971-1-philippe.waroquiers@skynet.be> References: <20191201155220.15971-1-philippe.waroquiers@skynet.be> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-12/txt/msg00190.txt.bz2 On Sun, 1 Dec 2019 16:52:20 +0100 Philippe Waroquiers wrote: > Valgrind detects various inferior related leaks, such as: > ==31877== 5,530 (56 direct, 5,474 indirect) bytes in 1 blocks are definitely lost in loss record 7,131 of 7,355 > ==31877== at 0x4C2E18C: calloc (vg_replace_malloc.c:760) > ==31877== by 0x23E580: xcalloc (alloc.c:100) > ==31877== by 0x4794A9: xcnewvec (poison.h:158) > ==31877== by 0x4794A9: registry_alloc_data(registry_data_registry*, registry_fields*) (registry.c:51) > ==31877== by 0x3A537C: inferior_alloc_data (inferior.c:43) > ==31877== by 0x3A537C: inferior::inferior(int) (inferior.c:92) > ==31877== by 0x3A5426: add_inferior_silent(int) (inferior.c:98) > ==31877== by 0x3A5530: add_inferior(int) (inferior.c:122) > ... > > Origin of the leaks is in prune_inferiors: prune_inferiors is first removing > the inferior to prune from the inferior list, then calls delete_inferior. > But delete_inferior will only really destroy the inferior when it finds > it into the inferior list. > As delete_inferior is removing the inferior to delete from the inferior list, > ensure prune_inferiors only calls delete_inferior, without touching the > inferior list. > > gdb/ChangeLog > YYYY-MM-DD Philippe Waroquiers > * inferior.c (prune_inferiors): Only call delete_inferior, > Do not modify the inferior list. Okay. (Though I'd rather see a semicolon or a period in place of the comma in the ChangeLog entry.) Kevin