public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
Cc: Tom de Vries <tdevries@suse.de>
Subject: Re: [RFC 2/2] [gdb/exp] Clean up asap in value_print_array_elements
Date: Thu, 14 Sep 2023 08:51:55 -0600	[thread overview]
Message-ID: <87r0n0hkok.fsf@tromey.com> (raw)
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")

>>>>> "Tom" == Tom de Vries via Gdb-patches <gdb-patches@sourceware.org> 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 <repeats 2097152 times>)
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: <n>".

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@tromey.com>

Tom

  reply	other threads:[~2023-09-14 14:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-04  5:41 [RFC 1/2] [gdb/testsuite] Modernize gdb.base/huge.exp Tom de Vries
2023-09-04  5:41 ` [RFC 2/2] [gdb/exp] Clean up asap in value_print_array_elements Tom de Vries
2023-09-14 14:51   ` Tom Tromey [this message]
2023-09-14 14:20 ` [RFC 1/2] [gdb/testsuite] Modernize gdb.base/huge.exp Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r0n0hkok.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).