From: "Daniel Shahaf" <d.s@daniel.shahaf.name>
To: "Oliver Kiddle" <okiddle@yahoo.co.uk>,
"Wesley Schwengle" <wesley@mintlab.nl>
Cc: zsh-workers@zsh.org
Subject: Re: segfault via completion menu
Date: Tue, 21 May 2019 21:58:11 +0000 [thread overview]
Message-ID: <90e15b90-14bb-4ef0-9aef-cc15c0fa0935@www.fastmail.com> (raw)
In-Reply-To: <92606-1558385755.382793@sll5.5oha.0as1>
Oliver Kiddle wrote on Mon, 20 May 2019 20:57 +00:00:
> Backing that out on top of master appears to fix the issue. As it was an
> optimisation, that might be an option. From reading comments in mem.c,
> it's not especially clear to me what newheaps/oldheaps do. There's only
> the one other use.
It's not too clear to me either.
The defining property of a heap, IIUC, is that freeheap() and popheap()
release all heap-allocated memory allocated since the last pushheap().
In this respect they're analogous to APR pools, which I'm familiar
with¹.
Then, what NEWHEAPS() seems to do is put away the entire stack
of heaps, create a new stack of heaps, and then OLDHEAPS() frees the
entire new stack of heaps and reverts to the old one. How is this
better than simply doing pushheap() and popheap()?
- Code between NEWHEAPS() and OLDHEAPS() doesn't have to be careful to
match pushheap() and popheap() calls exactly, because OLDHEAPS() will
clean up everything anyway.
- Anything allocated on heap between NEWHEAPS() and OLDHEAPS() becomes
invalid once OLDHEAPS() is called.
- There might be some considerations about maximum depth of the stack or
total number of bytes allocated by heaps in a single stack?
- (Anything else?)
HTH,
Daniel
¹ https://subversion.apache.org/docs/community-guide/conventions.html#apr-pools
pushheap() ≈ { p = apr_pool_create(p); }
popheap() ≈ { tmp = p->parent; apr_pool_destroy(p); p = tmp; }
next prev parent reply other threads:[~2019-05-21 21:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-09 14:30 Wesley Schwengle
2019-05-20 20:55 ` Oliver Kiddle
2019-05-21 21:58 ` Daniel Shahaf [this message]
2019-05-21 22:19 ` Bart Schaefer
2019-05-22 8:49 ` Peter Stephenson
2019-05-23 16:34 ` Peter Stephenson
2019-05-24 22:34 ` Peter Stephenson
2019-05-31 12:00 ` Wesley Schwengle
2019-05-31 13:29 ` Peter Stephenson
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=90e15b90-14bb-4ef0-9aef-cc15c0fa0935@www.fastmail.com \
--to=d.s@daniel.shahaf.name \
--cc=okiddle@yahoo.co.uk \
--cc=wesley@mintlab.nl \
--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).