Andy Kittner wrote:
> On 15/04/15 14:28, Bram Moolenaar wrote:
> >
> > Christian Brabandt wrote:
> >
> >> On Di, 14 Apr 2015, Bram Moolenaar wrote:
> >>
> >>> It's weird to exit when running out of memory, that's not what users
> >>> want. It's easy to accidentally make a Vim script that consumes all
> >>> memory. It's making things easier for developers and worse for users.
> >>> Considering there are many more users than developers, that's a bad
> >>> choice.
> >>
> >> Chances are high, your vim will be killed by the kernels OOM killer if
> >> you ran out of memory, so that does not make any difference in
> >> practice.ยน
> >
> > The kernel killing a process for OOM? I have never seen that. I
> > believe it can happen in Linux if you use fork() and virtual memory, it
> > allows a process to run even though the memory isn't actually available.
> > But Vim doesn't do that.
>
> IIRC this is due to memory "overcommiting" in general and is unrelated
> to fork() use of the program itself
>
> There are sysctl knobs to tune the behaviour [1], but the default
> configuration is overcommit enabled. That is one reason why exiting on
> malloc failure is relatively common (the memory allocations in glib for
> examples to this as well IIRC, and glib is used by a lot of things these
> days).
> The other commonly cited argument is that for any reasonable guarantees
> every library used must also handle out of memory carefully (for example
> a Gtk-GVim can still exit randomly on OOM). So most people consider it
> more worthwhile to keep sudden process death in mind, rather then
> wasting time on handling malloc returning NULL.
> I think vim with it's swapfiles is in quite good shape there, at least
> they saved me a few times already (more from myself than from the
> OOM-killer though ;))
>
>
> [1] For example these:
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/vm/overcommit-accounting?id=refs/tags/v4.0
Yeah, this is an old discussion point. I know it's one reason why a lot
of data centers run FreeBSD instead of Linux. Obviously Linux has
become more popular, but that's because of distributions and features,
not because of the kernel working well (esp. on a busy system FreeBSD
runs much better).
Anyway, it does pay off to handle out-of-memory situations gracefully
for a text editor. Yes it is means work, but no, it's not wasted. It's
just lazy programmers that call it wasted time.
Do you think users will tolerate a regexp engine that may crash any time
when you are searching?
--
Clothes make the man. Naked people have little or no influence on society.
-- Mark Twain (Samuel Clemens) (1835-1910)
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.