bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#26952: 25.1; loops eating all memory while yanking big rectangle


From: npostavs
Subject: bug#26952: 25.1; loops eating all memory while yanking big rectangle
Date: Sat, 20 May 2017 15:27:39 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:
>> 
>> The following simple loop can trigger the issue (I'm now also limiting
>> Emacs' memory usage to 1GB with "ulimit -Sv $((1000 * 1024))" so that it
>> just throws an out of memory error instead of filling my swap and
>> slowing everything down):
>> 
>>   (let ((str (make-string 150 ?a)))
>>     (dotimes (_ (* 600 1000))
>>       (insert str ?\n)))
>> 
>> I think it might be just an inefficient allocater (or this pattern of
>> allocation happens to hit a pathological case for the allocater).  The
>> master branch is using the 'hybrid' allocater, while emacs-25 is not.
>> If I configure 25.2 with REL_ALLOC=yes, then it runs okay.  The only
>> allocation seems to be from 'enlarge_buffer_text'.
>
> Thanks.
>
> So you are saying that inserting 90MB worth of text into a buffer
> makes Emacs 25.2 run out of 1GB of memory, due to inefficiencies of
> the malloc implementation?

When it's inserted in small chunks, yes, I think so.  What seems to
happen is that the buffer gap keeps getting realloc'd to be slightly
bigger, and the deallocated chunks don't get reused.

> (Here on Windows it produces a 230MB Emacs
> session, but the Windows build uses the moral equivalent of mmap for
> allocating buffer text.)

Neither master nor emacs-25 are using mmap (according to configure
output), but I guess the "hybrid" or relocating allocaters are smart
enough to handle this case.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]