From: Dmitry Antipov <dmantipov@yandex.ru>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: warn-maybe-out-of-memory
Date: Fri, 11 Jul 2014 12:43:39 +0400 [thread overview]
Message-ID: <53BFA3BB.6090709@yandex.ru> (raw)
In-Reply-To: <837g3kbd9g.fsf@gnu.org>
On 07/11/2014 10:50 AM, Eli Zaretskii wrote:
> But if this warning is to be useful, it should catch the majority of
> the cases, otherwise we are just wasting cycles. With the current
> test, many cases of visiting files that cannot be accommodated will go
> undetected, thus rendering all this feature useless.
With this feature, I'm just trying to redirect user to `find-file-literally'
if file looks so large that `find-file-noselect' is likely to run out of
memory. What other cases do you mean?
> Since it's only a warning that doesn't prevent visiting a file, it is
> better to err on the other side of the truth. E.g., apply some
> heuristics as to the average expansion factor, perhaps dependent on
> the locale.
IIUC there are no reliable heuristics here. For example, produce_charset
and compose_text may allocate substantial amount of memory to represent
`composition' and `charset' extra properties, and we need to read and
decode everything to find all places where such an extra properties
should be attached.
> And don't forget that even for plain-ASCII files we
> allocate the gap in addition to the text itself, so the mere size of
> the file is simply _never_ the correct value, it is always an
> underestimation. IOW, this test is always biased towards lower
> values.
Unless someone still uses a machine with 64K RAM, initial gap size
is very small in comparison with file sizes we're talking about.
> If we don't do something like that, then I wonder what exactly is the
> use case that benefits from this warning?
We don't need to do "something like that", i.e. we don't need a precise
estimation. OSes are tricky about memory management; overall VM picture
may drastically change when file reading is in progress, etc. With a lot
of constraints you can't predict, estimate and control, precise estimation
just makes no sense.
> It is IMO inappropriate for a minor feature like this one to abort
> Emacs. Who knows what the Linux kernel developers will introduce
> tomorrow that could possibly fail the function? It is none of this
> feature's business to be the place where C stack smashing is detected.
> So my vote is for returning nil and perhaps displaying a warning.
OK.
Dmitry
next prev parent reply other threads:[~2014-07-11 8:43 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-10 18:23 warn-maybe-out-of-memory Eli Zaretskii
2014-07-10 18:47 ` warn-maybe-out-of-memory Eli Zaretskii
2014-07-11 4:42 ` warn-maybe-out-of-memory Dmitry Antipov
2014-07-11 6:50 ` warn-maybe-out-of-memory Eli Zaretskii
2014-07-11 8:43 ` Dmitry Antipov [this message]
2014-07-11 9:02 ` warn-maybe-out-of-memory Eli Zaretskii
2014-07-11 9:43 ` warn-maybe-out-of-memory Dmitry Antipov
2014-07-11 10:00 ` warn-maybe-out-of-memory Eli Zaretskii
2014-07-11 10:14 ` warn-maybe-out-of-memory Eli Zaretskii
2014-07-11 10:34 ` warn-maybe-out-of-memory Dmitry Antipov
2014-07-11 12:43 ` warn-maybe-out-of-memory Eli Zaretskii
2014-07-11 13:46 ` warn-maybe-out-of-memory Stefan Monnier
2014-07-12 17:17 ` warn-maybe-out-of-memory Glenn Morris
2014-07-13 7:01 ` warn-maybe-out-of-memory Dmitry Antipov
2014-07-13 23:00 ` warn-maybe-out-of-memory Glenn Morris
2014-07-15 3:45 ` warn-maybe-out-of-memory Stefan Monnier
2014-07-15 4:44 ` warn-maybe-out-of-memory Dmitry Antipov
2014-07-17 3:59 ` warn-maybe-out-of-memory Stefan Monnier
2014-07-11 13:28 ` warn-maybe-out-of-memory Drew Adams
-- strict thread matches above, loose matches on Subject: below --
2014-07-10 18:22 warn-maybe-out-of-memory Eli Zaretskii
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=53BFA3BB.6090709@yandex.ru \
--to=dmantipov@yandex.ru \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.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 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.