all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Pip Cet <pipcet@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
	Daniel Colascione <dancol@dancol.org>,
	emacs-devel@gnu.org
Subject: Re: Failing to GC killed buffers considered harmful
Date: Tue, 31 Mar 2020 15:20:03 -0400	[thread overview]
Message-ID: <jwvftdoibs4.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <CAOqdjBfSZdWzszC2VuzdZ9bQj=BJ6T4+LbZrTbaOzVbcV8_Bgg@mail.gmail.com> (Pip Cet's message of "Tue, 31 Mar 2020 18:23:40 +0000")

>> > buffer text.
>> The buffer text is not stored within the `struct buffer` object, so no.
> struct buffer_text, I meant.

Ah, right.  We do have pointers into that substructure coming from
indirect buffers.  These should all be accompanied by a `base_buffer`
pointer to the head of the `struct buffer`, so it's not 100% crucial
that we take those inner pointers into account, but yes, it does mean
that inner pointers into `struct buffer` are probably more likely than
for other pseudovectors.

Luckily, Paul's code already takes care of inner pointers into
pseudovectors, so we're good in either case.

> Well, I have created temporary buffers to act as, essentially, mutable
> strings. I see no reason I have to kill
> expensively-but-efficiently-implemented mutable strings explicitly
> before having them collected! More seriously, I do think making
> buffers more lightweight would be a good thing, perhaps even having an
> immutable string without text properties/mutable string with gap and
> some buffer properties/full-blown buffer spectrum.

You don't have to convince me.  I just haven't tried to solve this
long-standing need, and it's a can of worms, I think.

> (As I realize someone here usually demands use cases: I'd like to fix
> the hash table printing code to print hashes predictably.  That
> requires sorting their keys by something predictable. Their printed
> presentation is usually good enough, but that requires
> prin1-to-string, which uses a buffer. It's currently too slow.)

Have you tried to profile it to see where the time is spent, to have
a vague idea of what kind of slimming regime we'd need to impose to our
buffers before it becomes tolerable?

In any case, printing-then-sorting doesn't sound like a good plan:
I think it's inherently inefficient.

>> Indeed, my patch doesn't have anything to do with the original problem,
> I don't see how the original problem would fail to be solved by your patch.

Oh, maybe it would, but that was definitely not my motivation.

> Pdumper doesn't dump all objects that survive GC, only those it
> can reach from the heap (plus some collateral damage). So your patch
> restores that requirement precisely, and we can keep the assert()
> unless we decide we want to relax our standards and allow killed
> buffers during the dump.

I think if we want to re-introduce this assert, we should add a matching
test during pdump.


        Stefan




      reply	other threads:[~2020-03-31 19:20 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-29 14:23 Failing to GC killed buffers considered harmful Eli Zaretskii
2020-03-29 16:45 ` Stefan Monnier
2020-03-29 18:54   ` Eli Zaretskii
2020-03-29 19:06     ` Daniel Colascione
2020-03-29 19:24       ` Eli Zaretskii
2020-03-29 16:46 ` Pip Cet
2020-03-29 18:48   ` Eli Zaretskii
2020-03-29 19:07     ` Pip Cet
2020-03-29 19:12       ` Daniel Colascione
2020-03-29 19:25         ` Pip Cet
2020-03-29 19:28           ` Eli Zaretskii
2020-03-30 15:36             ` Pip Cet
2020-03-30 15:53               ` dancol
2020-03-30 17:07             ` Stefan Monnier
2020-03-30 17:02   ` Stefan Monnier
2020-03-30 18:32     ` Stefan Monnier
2020-03-30 18:51       ` Eli Zaretskii
2020-03-30 19:14         ` Daniel Colascione
2020-03-30 19:40         ` Stefan Monnier
2020-03-31 14:07           ` Eli Zaretskii
2020-03-31 14:09       ` Eli Zaretskii
2020-03-31 21:57         ` Stefan Monnier
2020-03-31 14:58       ` Pip Cet
2020-03-31 16:52         ` Stefan Monnier
2020-03-31 18:23           ` Pip Cet
2020-03-31 19:20             ` Stefan Monnier [this message]

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=jwvftdoibs4.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=dancol@dancol.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=pipcet@gmail.com \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.