Zsh Mailing List Archive
Messages sorted by:
Re: High memory usage on // substitution in one situation, normal usage in other
- X-seq: zsh-workers 41133
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: High memory usage on // substitution in one situation, normal usage in other
- Date: Sun, 21 May 2017 13:03:49 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=Il53vzfVYG57AXZ11ll7HffYDyNaYe8Kf525/j5VkCw=; b=RCJYGMdGfe0qkp3tFgtj6LKAT0z26ztXQgObdK0OapR+mVYsYjhhHLgapM1Rn8K+z4 AGyd+vDD+bUSqm9ZG96GmeoVYSUlkHwr+X4PHfGAu/2Z/M+YfePJlDrroOzTyTaGWXfU /F3jiYR85jKGfM0HJZyi5ZR6jc2MKX2GKloelHf9zLlIrwdpw0qCQ/x1ud16xj22Sd87 i8PAJMZva3Uqj2llXrQHbSySWiLyuP9aCb3koXEK/Mxq0+Fxege/P/ybXAFYQs/6JAPA 2Hq5OYGfzvVSn2sQHQBG7ynTYrb8XbMPY+K5Ye64Q6TlTts/wdvHoJDtMH2b1/9sLEdv X4hQ==
- In-reply-to: <etPan.59214193.41a7c4c9.6b4c@MacMini.local>
- List-help: <mailto:firstname.lastname@example.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:email@example.com>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <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
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:
(skip gradual shrinking during "for" loop)
The second like this:
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.
Messages sorted by: