From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta36.uswest2.a.cloudfilter.net (omta36.uswest2.a.cloudfilter.net [35.89.44.35]) by sourceware.org (Postfix) with ESMTPS id 7B0B03858C5F for ; Thu, 14 Sep 2023 14:52:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7B0B03858C5F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com Received: from eig-obgw-5001a.ext.cloudfilter.net ([10.0.29.139]) by cmsmtp with ESMTP id gYYgqAlqnEoVsgnhGq5L1N; Thu, 14 Sep 2023 14:51:58 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id gnhEqdLMNXFhSgnhFqqmrr; Thu, 14 Sep 2023 14:51:57 +0000 X-Authority-Analysis: v=2.4 cv=JsXiEe0C c=1 sm=1 tr=0 ts=65031e0d a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=zNV7Rl7Rt7sA:10 a=Qbun_eYptAEA:10 a=CCpqsmhAAAAA:8 a=zstS-IiYAAAA:8 a=twkdBeP2-x001OIzWoEA:9 a=ul9cdbp4aOFLsgKbc677:22 a=4G6NA9xxw8l3yy4pmD5M:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=yFLuVh43O5HmlSxe0KPJ6Ptqdqgnn2WnpdKncR1U/1E=; b=RLOpdJZmwFA+JWkcvhb+SqnmEp +kaIzaFhNoQdv25x2rnMHzqiGiUgNxr/hGm8spSjvd13y+QQFwtw4AJsSW0GtdPYkmvku3cuaufdf GEsh1RclijsykPyShV0+cUJrA; Received: from 71-211-130-31.hlrn.qwest.net ([71.211.130.31]:57872 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qgnhE-002YN3-1d; Thu, 14 Sep 2023 08:51:56 -0600 From: Tom Tromey To: Tom de Vries via Gdb-patches Cc: Tom de Vries Subject: Re: [RFC 2/2] [gdb/exp] Clean up asap in value_print_array_elements References: <20230904054148.24552-1-tdevries@suse.de> <20230904054148.24552-2-tdevries@suse.de> X-Attribution: Tom Date: Thu, 14 Sep 2023 08:51:55 -0600 In-Reply-To: <20230904054148.24552-2-tdevries@suse.de> (Tom de Vries via Gdb-patches's message of "Mon, 4 Sep 2023 07:41:48 +0200") Message-ID: <87r0n0hkok.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 71.211.130.31 X-Source-L: No X-Exim-ID: 1qgnhE-002YN3-1d X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 71-211-130-31.hlrn.qwest.net (murgatroyd) [71.211.130.31]:57872 X-Source-Auth: tom+tromey.com X-Email-Count: 7 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfCURREahhhqTZ6NhHOquiRTDIiDuCXqwvW2LtXUn+xNZVPwp9D8pUOqGsYkzGGLyxJdY++Nl36STF8cKH37AqgTtJGgbkhhwPheCEQsorbfWi5L8Ey1e OMleMFZ9OzaN1HVk2XwRq7VHzStvFIFPdUGxB0nSScK8lo8q4HluZLpkIXO0ZfixnafGq932F9kMaIFa5D9pVnVCHEzG3TGNkxk= X-Spam-Status: No, score=-3018.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: >>>>> "Tom" == Tom de Vries via Gdb-patches writes: Tom> I've been running the test-suite on an i686-linux laptop with 1GB of memory, Tom> and 1 GB of swap, and noticed problems after running gdb.base/huge.exp: gdb Tom> not being able to spawn for a large number of test-cases afterwards. Tom> So I investigated the memory usage, on my usual x86_64-linux development Tom> platform. Thank you for doing this. Tom> The problem also exists for Ada: Tom> ... Tom> +print Arr Tom> value_free_to_mark freed 2097152 items Tom> $1 = (0 ) Tom> ... Tom> but is fixed by the fix for C. I suspect a similar problem exists in val_print_packed_array_elements, which is only used for packed arrays. I am happy to fix this up after your patch goes in, though. Tom> RFC: the regression test included in the patch is formulated in its weakest Tom> form, to avoid false positive FAILs, which also means that smaller regressions Tom> may not get detected. Tom> A better way to write a regression test could involve adding more specific or Tom> complete memory statistics, for instance: Tom> - use the equivalent of VIRT as displayed by top, in a command Tom> "maint set per-command virt-space on/off", or Tom> - use gdb-specific memory statistics, printed by Tom> "maint set per-command mem-stats on/off", with one line containing Tom> "max value_free_to_mark freed items: ". Tom> The latter has less generic usefullness, but is easier to implement and easy Tom> to extend, and can be written such that it's guaranteed to work the same on Tom> all platforms, so it's my preferred option. Tom> Alternatively, we could add a warning in value_free_to_mark with a treshold Tom> controlled by a setting. I tend to think what you did here is fine. The main point is to avoid explosive growth. Approved-By: Tom Tromey Tom