From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#26952: 25.1; loops eating all memory while yanking big rectangle Date: Sat, 20 May 2017 15:27:39 -0400 Message-ID: <87shjzgwgk.fsf@users.sourceforge.net> References: <87zie8gyu4.fsf@users.sourceforge.net> <83h90fq269.fsf@gnu.org> <87vaovh1db.fsf@users.sourceforge.net> <8360gvpfxr.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1495308431 17763 195.159.176.226 (20 May 2017 19:27:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 20 May 2017 19:27:11 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) Cc: 26952@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat May 20 21:27:07 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCA1r-0004WH-6U for geb-bug-gnu-emacs@m.gmane.org; Sat, 20 May 2017 21:27:07 +0200 Original-Received: from localhost ([::1]:35216 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dCA1w-00053m-9n for geb-bug-gnu-emacs@m.gmane.org; Sat, 20 May 2017 15:27:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53090) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dCA1q-00051l-7B for bug-gnu-emacs@gnu.org; Sat, 20 May 2017 15:27:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dCA1n-0007oK-32 for bug-gnu-emacs@gnu.org; Sat, 20 May 2017 15:27:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:54596) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dCA1m-0007oE-WC for bug-gnu-emacs@gnu.org; Sat, 20 May 2017 15:27:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dCA1m-0001XQ-Gr for bug-gnu-emacs@gnu.org; Sat, 20 May 2017 15:27:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 20 May 2017 19:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26952 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 26952-submit@debbugs.gnu.org id=B26952.14953083725855 (code B ref 26952); Sat, 20 May 2017 19:27:02 +0000 Original-Received: (at 26952) by debbugs.gnu.org; 20 May 2017 19:26:12 +0000 Original-Received: from localhost ([127.0.0.1]:57273 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCA0x-0001WH-LW for submit@debbugs.gnu.org; Sat, 20 May 2017 15:26:11 -0400 Original-Received: from mail-it0-f53.google.com ([209.85.214.53]:32778) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCA0v-0001Vz-Vo; Sat, 20 May 2017 15:26:10 -0400 Original-Received: by mail-it0-f53.google.com with SMTP id w68so993939itc.0; Sat, 20 May 2017 12:26:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=slXeD/f7ANThqU/3MI6lv/wgKlAhhL9jbg0IMYiSHA4=; b=beFUsqxRGlhu4t9/AE0SW+oVocq9hJrzLm1jXsdvKqxq7mO9+HYlzvpERDudWcWxS5 BW78pgF4t+Bc6dD2Fw0pIgO+/mekRqDmUVuqG1cELoT7h+M3hp5bCMY0JWxByUh/uQuY j+gKzMJZONgHe4CQwlwr52XYbdvH0VW0/wdsnQuVQ4rKsVunvNhliQfxEGDCIrqciHDl 02G+GSseCV3PA/lpwSjCdo/u1JDLC2mT52d0AonK/MzlhTDRm60oMUWq9WvMU62MFtIC UXmnoxnSjSoXJPDypXOZ+T5/pr1iEmKaOT30U3kZ0/LThTBrX8lI20lYk3bxfcZfkcu+ ylAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=slXeD/f7ANThqU/3MI6lv/wgKlAhhL9jbg0IMYiSHA4=; b=O5qmPEQmmYxDxAMNnK8L4Wg5Jm/XjdXwMyzTtFuFAd6+Sr57Z77yEqzjVCA4RypkkS 1VKKEy+YkFeGXilnt3kcWPLT8veGWxQ8uTfsu9FdpNCIchgR0mtTw+TieDoGUTMYXi4O MdJS7EEYmFAcT/HSaRPAJsz3U52KutAIJEougmxIdvndPJbwkHUSuYIH/DWaEp3GGhMs THhFKd3VlRBOUFZFLIjakxufPA9Ut2tfrY5J4a1txmO00VemYpItXYyvFTohDyv/+gqa lA8LJ46nkq/F0YMLZMeJ8hevWa78ofcLeenPZhoxBChk+HD5zuGXKFbz3lWFYwR1kVmp JpYA== X-Gm-Message-State: AODbwcDdSOdxuASxZ18wtkRz79iM0IgFw+PxqooHAuHcHQ8rozfAN3Nj /W9UhznARWiDBrIQ X-Received: by 10.36.224.133 with SMTP id c127mr34967671ith.73.1495308364199; Sat, 20 May 2017 12:26:04 -0700 (PDT) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id n14sm923834itg.0.2017.05.20.12.26.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 20 May 2017 12:26:03 -0700 (PDT) In-Reply-To: <8360gvpfxr.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 20 May 2017 20:59:44 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:132678 Archived-At: Eli Zaretskii 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.