From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Greg Hendershott Newsgroups: gmane.emacs.bugs Subject: bug#56623: memory leak introduced by new nonrecursive lisp reader Date: Mon, 29 Aug 2022 08:59:21 -0400 Message-ID: <87ilmbw6hi.fsf@greghendershott.com> References: <7DC3EB6A-097E-46F1-806E-33C02F01EA47@acm.org> <8735dh7l86.fsf@gnus.org> <87k06swa2o.fsf@greghendershott.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15006"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 0.9.18; emacs 25.2.2 Cc: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , 56623@debbugs.gnu.org To: Lars Ingebrigtsen , Tom Gillespie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 29 17:27:56 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oSgg6-0003hu-6y for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 29 Aug 2022 17:27:55 +0200 Original-Received: from localhost ([::1]:37794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSgg5-0007EN-3v for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 29 Aug 2022 11:27:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36910) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSgfG-0006J2-Nj for bug-gnu-emacs@gnu.org; Mon, 29 Aug 2022 11:27:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43726) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oSgfG-00020g-Et for bug-gnu-emacs@gnu.org; Mon, 29 Aug 2022 11:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oSgfG-0003ge-AG for bug-gnu-emacs@gnu.org; Mon, 29 Aug 2022 11:27:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Greg Hendershott Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 29 Aug 2022 15:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56623 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 56623-submit@debbugs.gnu.org id=B56623.166178678914114 (code B ref 56623); Mon, 29 Aug 2022 15:27:02 +0000 Original-Received: (at 56623) by debbugs.gnu.org; 29 Aug 2022 15:26:29 +0000 Original-Received: from localhost ([127.0.0.1]:33475 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oSgei-0003fa-QH for submit@debbugs.gnu.org; Mon, 29 Aug 2022 11:26:29 -0400 Original-Received: from out4-smtp.messagingengine.com ([66.111.4.28]:37531) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oSeMT-0005SA-AB for 56623@debbugs.gnu.org; Mon, 29 Aug 2022 08:59:30 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 2321E5C0151; Mon, 29 Aug 2022 08:59:23 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 29 Aug 2022 08:59:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= greghendershott.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1661777963; x= 1661864363; bh=WQToX8fE2YWqh/uufyt1x/M/I58+qCG2jkwNVLgWKD8=; b=n YHDm0/ADy6cKIgfFl/zZ3NRqAPe4bfMKr4pCp5NV2sa7qd5bzTTovD8sCUbFojcR FbUxFC7KmwD9uS6V9cQjTexUho9nfzv+y8Hiu/8GRcm36SEmDUiLhXjfa6T7khD/ +Ar1I5mm6LcsIciH037x2uPTAaCqZ1o5aDsC03dBfEq08qOwpsYOCbUw/4ZeMS1g R/vvuCKjL6zF04WYRmG3iFCaOqCB/ynsQzzGYcoFIxFT2x6c5Gg20dZiM6ZJboVE fGHAx5LVS/Ov8/jQcNPKsM0JdccGAzknFCOALJSRju2PizvQe2dhPrOXPuNOVYNR hfe7eNqFfiqdn+JgXv0jQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1661777963; x=1661864363; bh=WQToX8fE2YWqh/uufyt1x/M/I58+ qCG2jkwNVLgWKD8=; b=VSYxfWF/jW5CeyYA72AHSYG7RLLcjdyMVV0vHVvHo5Ff n4rBqNA0a+8HH5TJRbouDMHlKmF8NIqWG0kFJYMGcqcrAEbTXTUdjU3g96eOQoMb cLjqfKRDVHVInrbUWUL+gw2JaCSMkh3lI2Gd6t4zKG+9Ciio4obFKiS9KFa+v8Te iJiPYsjn9tgt1TJRVMrQs4q1xAWr0eEpeUXo/Op+mLckS8g0dmXwTDKyNRTzDZSQ 6eTos81g8rx+1VYPb5QDKJl7NPivZg3FB/oV6eEhVHzap9/Ru/Svzsp9LO0Gfber 3507uXQS7oAo2l0uy+KjFpkOREZ5Nqwt2CTl+IOmAA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfhgfhffvvefujgffkfggtgesthdtredttdertdenucfhrhhomhepifhrvghg ucfjvghnuggvrhhshhhothhtuceomhgrihhlsehgrhgvghhhvghnuggvrhhshhhothhtrd gtohhmqeenucggtffrrghtthgvrhhnpeeiveelhfehtdefgeduteehtdetvdehteejjedu hfejgfetkeevuedvvdeludelveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehmrghilhesghhrvghghhgvnhguvghrshhhohhtthdrtghomh X-ME-Proxy: Feedback-ID: i77e94416:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 08:59:22 -0400 (EDT) In-reply-to: X-Mailman-Approved-At: Mon, 29 Aug 2022 11:26:27 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:241041 Archived-At: I think I've discovered the problem. The new `read' leaks when it errors. Here's a little driver to elicit this: -------------------------------------------------- ;; Run this with e.g. emacs --batch -Q -l example.el (message "Run htop and observe the RES value") (dotimes (n 512) (message "%s" n) (with-temp-buffer ;; Insert an unclosed sexp (insert "(") ;; Make it large, with quite a few sub-expressions to read (dotimes (_ 8192) (insert (format "%S" '(foo bar baz "a somewhat long string blah blah blah blah blah\n")))) ;; Go to start and attempt a read. This will fail due to the ;; unclosed paren, so we use `ignore-errors'. (goto-char (point-min)) (ignore-errors (read (current-buffer))))) ;; With the old recursive lread.c, the RES value will oscillate around ;; a stable low value (presumably as GC happens). ;; With the new non-recursive lread.c, the RES value will climb ;; unbounded into hundreds of megabytes. -------------------------------------------------- I hope this helps!