Nikolay Pavlov wrote:

> 2016-04-24 15:35 GMT+03:00 Bram Moolenaar <[email protected]>:
> >
> > John Little wrote:
> >
> >> On Friday, April 22, 2016 at 8:13:21 PM UTC+12, Lekare wrote:
> >>
> >> > When entering something really big, like
> >> >
> >> > :put =range(30000000000,300000000000000000000)
> >> >
> >> > Vim quits with message
> >> >
> >> > Vim: Caught deadly signal SEGV
> >> > Vim: Finished.
> >> > [1]    75479 segmentation fault  \vim
> >>
> >> On my x86-64 with 16 GiB of RAM, that causes vim to gallop through
> >> memory at about 2 GiB/s, then linux is in strife, until
> >>
> >> [ 4382.649514 ] Out of memory: Kill process 2965 (gvim) score 917 or 
> >> sacrifice child
> >> [ 4382.650036 ] killed process 2965 (gvim) total-vm:30326512kB, 
> >> anon-rss:15751236kB, file-rss:160kB
> >>
> >> The point I'm trying to make is that if you ask vim to do stuff beyond
> >> the resources of the system it's running on, vim will try, and the
> >> failure depends on that system.  IMO it would be very difficult to
> >> code vim to reliably catch all the ways it can fail like this.
> >
> > I've been trying to make Vim survive bad user behavior.  An out of
> > memory situation should be handled gracefully.
> >
> > Looks like the problem is with the system: gdb says the crash happens in
> > ga_grow() when calling memset(), after checking that the pointer
> > returned by alloc() or realloc() is not NULL.
> 
> Linux has such thing as overcommit:
> https://www.kernel.org/doc/Documentation/vm/overcommit-accounting.
> I.e. system may allow you to allocate more memory then it actually
> has, at a cost of runtime errors obviously. This can be disabled.

This is also interesting (perhaps a bit outdated):
http://www.win.tue.nl/~aeb/linux/lk/lk-9.html#ss9.6

What we would actually want is to specify per process what kind of
memory allocation strategy to use.  I don't hink this exists.


> > Unfortunately, Linux behaves quite badly.  When I try that range() call
> > the whole system becomes unusable. Even the cursor freezes.  This is one
> > situation that BSD handles much better.
> 
> I have the same thing, except that it also kills some browser tabs (in
> chromium-based browsers I have working), in place of killing Vim which
> allocated lots of memory.

Yes, Chrome tabs freeze (grey-out).

-- 
Yesterday is history.
Tomorrow is a mystery.
Today is a gift.
That's why it is called 'present'.

 /// 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.

Raspunde prin e-mail lui