From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: High memory usage on // substitution in one situation, normal usage in other
Date: Sun, 21 May 2017 13:03:49 -0700 [thread overview]
Message-ID: <170521130349.ZM4506@torch.brasslantern.com> (raw)
In-Reply-To: <etPan.59214193.41a7c4c9.6b4c@MacMini.local>
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:03 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 [this message]
2017-05-21 20:47 ` Re[2]: " Manuel Presnitz
[not found] ` <201705212227360937.046E4951@gateway.core.mpy.ch>
2017-05-21 23:43 ` 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=170521130349.ZM4506@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--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).