From: "Manuel Presnitz" <mail@mpy.de>
To: zsh-workers@zsh.org
Subject: Re[2]: High memory usage on // substitution in one situation, normal usage in other
Date: Sun, 21 May 2017 22:47:40 +0200 [thread overview]
Message-ID: <201705212247400859.0480A18C@gateway.core.mpy.ch> (raw)
In-Reply-To: <170521130349.ZM4506@torch.brasslantern.com>
Good evening, Ladies and Gentlemen,
I can reproduce the extraordinary high memory usage (until the process is killed) of Sebastian's first code example with zsh-5.3.1-88-gd8c66e6 running on Linux; but only if EXTENDEDGLOB is set.
Best regards,
Manuel.
Bart Schaefer hat am 21.05.2017 um 13:03 folgendes geschrieben:
> On May 21, 9:28am, Sebastian Gniazdowski wrote:
> }
> } following will cause like 55 GB of VIRT memory usage (process will
> } be killed), having RES memory at 1.8 MB, which roughly equals to
> } ${#__text}.
>
> I can't reproduce this. The for loop takes a lot longer to create the
> array than does the simple assignment, but neither example uses a huge
> amount of memory.
>
> Since you had a "local -A arr2" in your first example, I ran each of
> the examples in an anon function in a fresh shell. I also tried the
> second example both with "local -a arr" added, and as you posted it,
> but that didn't really make any difference.
>
> On my system, the associative arr2 case looks like this:
>
> swap free
> 412780 81244
> (skip gradual shrinking during "for" loop)
> 412780 33260
> 412780 33260
> 412780 58668
>
> The second like this:
>
> swap free
> 412780 81420
> 412780 38092
> 412780 36748
> 412780 36772
> 412780 31524
> 412780 22692
> 412780 66532
>
> The $__text value is global in both cases so the delta between the first
> and last "free" numbers is the memory consumed by that plus any unused
> space in the last unpopped zsh heap block.
>
> In both cases the // expression is almost instantaneous, much faster than
> creating the $__text string in the first place. Neither uses any swap.
> My config.h defines HAVE_MMAP 1, so the zsh heap is allocated as an
> anonymous mapfile, but I don't have 55GB free on the filesystem so I
> don't think that can be a factor.
next prev parent reply other threads:[~2017-05-21 20:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-21 7:28 Sebastian Gniazdowski
2017-05-21 20:03 ` Bart Schaefer
2017-05-21 20:47 ` Manuel Presnitz [this message]
[not found] ` <201705212227360937.046E4951@gateway.core.mpy.ch>
2017-05-21 23:43 ` Re[2]: " Bart Schaefer
2017-05-22 3:31 ` Sebastian Gniazdowski
2017-05-22 8:50 ` Daniel Shahaf
2017-05-22 15:00 ` Bart Schaefer
2017-05-23 15:33 ` Christian Neukirchen
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=201705212247400859.0480A18C@gateway.core.mpy.ch \
--to=mail@mpy.de \
--cc=zsh-workers@zsh.org \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
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 NNTP newsgroup(s).