From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.bugs Subject: bug#42482: 27.0.91; emacs modules memory leak Date: Thu, 23 Jul 2020 14:06:57 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37464"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 42482-done@debbugs.gnu.org To: Milan =?UTF-8?Q?Stanojevi=C4=87?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 23 14:08:11 2020 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 1jya1D-0009e9-JM for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 23 Jul 2020 14:08:11 +0200 Original-Received: from localhost ([::1]:38914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jya1C-0006JK-8e for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 23 Jul 2020 08:08:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55580) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jya14-0006GC-9u for bug-gnu-emacs@gnu.org; Thu, 23 Jul 2020 08:08:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60979) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jya14-00087q-0W for bug-gnu-emacs@gnu.org; Thu, 23 Jul 2020 08:08:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jya13-0005G2-S2 for bug-gnu-emacs@gnu.org; Thu, 23 Jul 2020 08:08:01 -0400 Resent-From: Philipp Stephani Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Jul 2020 12:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 42482 X-GNU-PR-Package: emacs Mail-Followup-To: 42482@debbugs.gnu.org, p.stephani2@gmail.com, mstanojevic@janestreet.com Original-Received: via spool by 42482-done@debbugs.gnu.org id=D42482.159550603520145 (code D ref 42482); Thu, 23 Jul 2020 12:08:01 +0000 Original-Received: (at 42482-done) by debbugs.gnu.org; 23 Jul 2020 12:07:15 +0000 Original-Received: from localhost ([127.0.0.1]:44290 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jya0J-0005Eq-II for submit@debbugs.gnu.org; Thu, 23 Jul 2020 08:07:15 -0400 Original-Received: from mail-ot1-f49.google.com ([209.85.210.49]:43688) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jya0H-0005Ee-Qj for 42482-done@debbugs.gnu.org; Thu, 23 Jul 2020 08:07:14 -0400 Original-Received: by mail-ot1-f49.google.com with SMTP id 95so4125950otw.10 for <42482-done@debbugs.gnu.org>; Thu, 23 Jul 2020 05:07:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=jmgGuqVgxZ6dyeNONIkEpR22CD4uabzcoa3uUAAdfhE=; b=OJm7r57aSKMDNlCzqd+gY9faDgFzxLiXDDnNr4NMo0Az16seXrcgAh0H1OVKkHlHiI PqOFojWCevVbcYbuGD0P8zfyqfXtuLlRUF7cLkzu/1fme3iJTkli8dgAY6Llj7GO2AoK cN3FwJmQbFtSxGbVtcVqV4hpEa3LF+Tqxmo9ZMhcKacZyE6xu5huDDcl6+gkvlHaKEYi AMacKmCnBUJk/uVlgcdZHD5PTF0pQc/xdWWLjyH22MLFxiDpPXOU6DnEwp5/hjh134zC YtDF2zqdO9ocOcN7n6e7M6u0BkmUhzwuZU9iTh0n/XeZ5yAaJQWFEQNN8e6sZAT8VaOH uCwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=jmgGuqVgxZ6dyeNONIkEpR22CD4uabzcoa3uUAAdfhE=; b=Y4/hAp39Km5S24ke4fTsVtEHI9DHPGKXT1+hLbKDl5PwUNolASzCuyzpCNc0NjEfOl etlhynOUB51zBlaO275tLoPLMD/J+PD71SILd8E6zksmyUNEYxFzuMrRUBLvMrSzVx77 zbcoAIaFcw/mq43HTSM69hhyuJZ2lza407PMsYgA1f7lACiVtvDo1wAeWgKX3BuGAl+z nPIDHoigaTqRcfzNeR46t9qwcj+MT+ioZI+EU1KNKvitZCnEX2LxhYLyqW3MORwtnFa2 nY8mmWl81LtIfBhGNYUfYqT9wYTqzzNY/AvTiZWMSrnTG3uYkXXpxFu8ZZtbXDC3LmcF WHzA== X-Gm-Message-State: AOAM533Yx2q7yAmlS0TNhppXx7/7ZIE3f3JjdDgPu/23GuhNN8WZi6Xe vJt9DKZZkIkwBvGN4vYQQYB2vMvj4bSX4TU9y4g= X-Google-Smtp-Source: ABdhPJwcXjsHRYFpaknqahe6I/8at3oGekOR3PDs0jZQwPnIumOLUZmvyjc0lqO0DWIQIt5Zhk+8SeYq0rhZ3ndT1Qc= X-Received: by 2002:a9d:2203:: with SMTP id o3mr3576600ota.149.1595506028153; Thu, 23 Jul 2020 05:07:08 -0700 (PDT) In-Reply-To: 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:183417 Archived-At: Am Do., 23. Juli 2020 um 01:27 Uhr schrieb Milan Stanojevi=C4=87 : > > env-make_global_ref adds a reference to the underlying Lisp_Object > and allocates emacs_value from the global storage. env->free_global_ref > on the other hand will only remove a reference to the underlying > Lisp_Object and not free the emacs_value. > > Here is a simple recipe to reproduce the problem (I only tested this > on linux). I'm attaching the necessary files. > > $ gcc -shared -fpic -std=3Dc99 -I > create_global_refs.c -o create_global_refs.so > $ emacs --no-splash -q -l create_global_refs.so -l create_global_refs_tes= t.el > > If you look at the memory usage of emacs (for example in htop) you'll > see that with emacs-26 it is constant but with emacs-27 the resident > memory quickly grows. Thanks for the report. I've fixed this in commit 5c5eb9790898e4ab10bcbbdb6871947ed3018569; the fix is slightly different from what you proposed in that it stores the emacs_value object in the global references hashtable, but it should have the same effect. At least I can't reproduce the symptom any more after that commit.