zsh-users
 help / color / mirror / code / Atom feed
From: Han Pingtian <hanpt@linux.vnet.ibm.com>
To: zsh-users@zsh.org
Subject: Re: argv subscript range uses too many memory
Date: Sat, 10 Nov 2012 18:58:11 +0800	[thread overview]
Message-ID: <20121110105811.GA7136@localhost.localdomain> (raw)
In-Reply-To: <20121108100226.575b0788@pwslap01u.europe.root.pri>

Looks like when running with 'print -- "$argv[1,3]", the call trace is
something like this:

(gdb) bt
#0  mmap_heap_alloc (n=0x7fff0852e880) at mem.c:449
#1  0x000000000045f5f9 in zhalloc (size=1594456) at mem.c:542
#2  0x00000000004a4dfa in arrdup (s=0x313b008) at utils.c:3648
#3  0x0000000000471fa9 in getarrvalue (v=0x7fff0852ea20) at params.c:2174
#4  0x00000000004961bf in paramsubst (l=0x7f51d6dd0bb0, n=0x7f51d6dd0bf8, str=0x7fff0852ee38, qt=1, pf_flags=0) at subst.c:2400
#5  0x0000000000491cbd in stringsubst (list=0x7f51d6dd0bb0, node=0x7f51d6dd0bf8, pf_flags=0, asssub=1) at subst.c:236
#6  0x0000000000491089 in prefork (list=0x7f51d6dd0bb0, flags=1) at subst.c:77
#7  0x000000000042dafb in execcmd (state=0x7fff0852f760, input=0, output=0, how=18, last1=2) at exec.c:2579
#8  0x000000000042b410 in execpline2 (state=0x7fff0852f760, pcode=323, how=18, input=0, output=0, last1=0) at exec.c:1677
#9  0x000000000042a56e in execpline (state=0x7fff0852f760, slcode=5122, how=18, last1=0) at exec.c:1462
#10 0x0000000000429c2c in execlist (state=0x7fff0852f760, dont_change_job=0, exiting=0) at exec.c:1245
#11 0x000000000042968a in execode (p=0x7f51d6dd0af0, dont_change_job=0, exiting=0, context=0x4af417 "toplevel") at exec.c:1057
#12 0x0000000000447dcb in loop (toplevel=1, justonce=0) at init.c:185
#13 0x000000000044b3f4 in zsh_main (argc=1, argv=0x7fff0852f938) at init.c:1616
#14 0x000000000040e034 in main (argc=1, argv=0x7fff0852f938) at ./main.c:93
(gdb)

But if running with 'print -- "$argv[1] $argv[2] $argv[3]", the call
trace is something like this:

(gdb) bt
#0  mmap_heap_alloc (n=0x7fff0852f4a0) at mem.c:449
#1  0x000000000045f5f9 in zhalloc (size=16) at mem.c:542
#2  0x0000000000490a1d in dupstring (s=0x4baa95 "%B%S%#%s%b") at string.c:39
#3  0x0000000000488f5c in promptexpand (s=0x4baa95 "%B%S%#%s%b", ns=1, rs=0x0, Rs=0x0, txtchangep=0x0) at prompt.c:185
#4  0x000000000049f6d6 in preprompt () at utils.c:1307
#5  0x0000000000447b11 in loop (toplevel=1, justonce=0) at init.c:121
#6  0x000000000044b3f4 in zsh_main (argc=1, argv=0x7fff0852f938) at init.c:1616
#7  0x000000000040e034 in main (argc=1, argv=0x7fff0852f938) at ./main.c:93

And the outputs showed before hitting the break point mmap_heap_alloc().


  reply	other threads:[~2012-11-10 13:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-08  8:40 Han Pingtian
2012-11-08 10:02 ` Peter Stephenson
2012-11-10 10:58   ` Han Pingtian [this message]
2012-11-10 14:57     ` Bart Schaefer
2012-11-20 13:04       ` Han Pingtian
2012-11-20 17:03         ` Bart Schaefer

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=20121110105811.GA7136@localhost.localdomain \
    --to=hanpt@linux.vnet.ibm.com \
    --cc=zsh-users@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).