zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Cc: Han Pingtian <hanpt@linux.vnet.ibm.com>
Subject: Re: argv subscript range uses too many memory
Date: Tue, 20 Nov 2012 15:22:57 -0800	[thread overview]
Message-ID: <121120152257.ZM5937@torch.brasslantern.com> (raw)
In-Reply-To: <20121120210552.19eb87a9@pws-pc.ntlworld.com>

On Nov 20,  9:05pm, Peter Stephenson wrote:
}
} Instead of optimising freeheap for the case where the are lots of
} heaps, could we just increase HEAPSIZE?  It's only 16384 (minus a
} header), which seems pretty small to me.

Note that HEAPSIZE is only the lower limit on the size of an arena.
The actual size will depend on the largest contiguous chunk requested
of zhalloc().  Which is a bit strange because all calls to zfree()
use the HEAPSIZE or HEAPFREE constants instead of h->size or perhaps
ARENA_SIZEOF(h).  It must really not matter to zfree().

In any case workers/29175 isn't really optimizing just for a lot of
heaps or even for a lot of allocated memory; it's optimizing for a
lot of calls to freeheap(), most of which don't really have anything
useful to do.  It's just that in Han Pingtian's example there IS
something useful to do, but the optimization skips doing it because
fheap has been advanced [by zhalloc()] to point only at the most
recently allocated block.

If you think of the heaps linked-list as proceeding left to right,
then with 29175 freeheap assumes fheap points somwhere in the middle
of the list, but zhalloc tends to move it too far to the right.  It
remains to be seen whether 30809 moves it too far back to the left
(that is, effectively reverses 29175).

Or ... I may have completely misinterpreted how freeheap is supposed
to do its work, and there's an entirely different optimization that
should be done in place of 29175.


  reply	other threads:[~2012-11-20 23:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20121108084001.GA7594@localhost.localdomain>
     [not found] ` <20121108100226.575b0788@pwslap01u.europe.root.pri>
     [not found]   ` <20121110105811.GA7136@localhost.localdomain>
     [not found]     ` <121110065709.ZM4781@torch.brasslantern.com>
2012-11-10 21:16       ` Peter Stephenson
     [not found]       ` <20121120130457.GD2500@localhost.localdomain>
     [not found]         ` <121120090300.ZM5552@torch.brasslantern.com>
2012-11-20 17:44           ` Bart Schaefer
2012-11-20 18:24             ` Bart Schaefer
2012-11-22  9:28               ` Han Pingtian
2012-11-22 18:29                 ` Bart Schaefer
2012-11-25  8:11                   ` Han Pingtian
2012-11-25 19:03                     ` Bart Schaefer
2012-11-29 23:37                       ` Han Pingtian
2012-11-20 21:05             ` Peter Stephenson
2012-11-20 23:22               ` Bart Schaefer [this message]
2012-11-22 22:33                 ` Han Pingtian

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=121120152257.ZM5937@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=hanpt@linux.vnet.ibm.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).