From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Milan_Stanojevi=C4=87?= Newsgroups: gmane.emacs.devel Subject: Re: emacs modules memory leak in 27 Date: Wed, 22 Jul 2020 19:37:50 -0400 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="10827"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jul 23 01:39:08 2020 Return-path: Envelope-to: ged-emacs-devel@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 1jyOKJ-0002jk-JG for ged-emacs-devel@m.gmane-mx.org; Thu, 23 Jul 2020 01:39:07 +0200 Original-Received: from localhost ([::1]:54472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jyOKI-0006OH-Cu for ged-emacs-devel@m.gmane-mx.org; Wed, 22 Jul 2020 19:39:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51300) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyOJk-0005xO-Lz for emacs-devel@gnu.org; Wed, 22 Jul 2020 19:38:32 -0400 Original-Received: from mxout1.mail.janestreet.com ([38.105.200.78]:49732) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyOJi-0005Re-MN for emacs-devel@gnu.org; Wed, 22 Jul 2020 19:38:32 -0400 X-JS-Received: from [30.32.81.38] (helo=igm-qpr-mailcore1) by mxout1.mail.janestreet.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.94) (envelope-from ) id 1jyOJh-0003nr-Ca for emacs-devel@gnu.org; Wed, 22 Jul 2020 19:38:29 -0400 X-JS-Flow: external X-JS-Received: by igm-qpr-mailcore1 with ocaml/mailcore/main_production (d5298a6170a2) (envelope-from ) id BfGM31-i_KbsA-Ls; 2020-07-22 19:38:29.382422-04:00 X-JS-Scanner-attachment: No attachments X-JS-Scanner-esets: Not scanned (internal mail) Original-Received: from mail-wm1-f71.google.com ([209.85.128.71]) by mxgoog2.mail.janestreet.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.94) id 1jyOJf-0008EI-WB for emacs-devel@gnu.org; Wed, 22 Jul 2020 19:38:28 -0400 Original-Received: by mail-wm1-f71.google.com with SMTP id e15so1724228wme.8 for ; Wed, 22 Jul 2020 16:38:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-transfer-encoding; bh=AEYj+tGANUocBrecOBbxqa5GJ671QJi65mAk/0iq4RU=; b=MOOc+OYo9ag8daBD6YbYZL0pU3PSBm5eFinb3sJcLpcyLtwki2S56zWUvCttnY6JUf BMhMMwEGFOUBb6BAYUifNGw92t3ktsCJVqY/K4s/xIHLURlc8nZgK38uywTQEdVcbNNv xdDMnqUctxNzz6LGvJjanExin4WoH/Aegl3BM= 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:content-transfer-encoding; bh=AEYj+tGANUocBrecOBbxqa5GJ671QJi65mAk/0iq4RU=; b=e5fUTJZKMTHi+C46bI2E52JiupcfUWGKyzQbj7MaQyTsffYjZwt5VMsSu/9ISOmhK0 oeQ64+oDoQyPspe4x+DM30psHAGeWB/fYp0rN89lZ3kZL/BsFz+AGglAv9GoykDwPRn/ g0DGsK9eHKt3dxTwsxBjPNpjexw+Bh7u//fgAuC+1KB6RW7iHoXk9gTTpjEm/BdMET3i CGxcVENM8hKIIP+eoqeNmeNSVRpRt0iuSrxL8m0dXw32dz1qaMS6O3IPn9CwU5Slzm6d I6nZ+kGD8303My7yM7MklkvTnjWlagbPsgwgoCNtFe5PnKebJilnoG3VaZ3TNFg7sLoc c2yw== X-Gm-Message-State: AOAM5317fIx+Z+Taw9BLNE8RnzAQzcAjusywemt5OpsQQZGp+N/W3GnY R6x6a5gV/AT8UXE95ALIERB2GROo/z66Ze02ru7lXbsNdphuMp6GIEP5w+hZ6EngC7iycHBFIEQ v+lVopRlQdkuhd+8hBKP+TIySLLg= X-Received: by 2002:a05:600c:21d3:: with SMTP id x19mr1695805wmj.174.1595461107068; Wed, 22 Jul 2020 16:38:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylZ4h1okjNQFZK7Gf3MJcvrv/Qad6pnac9DVo0AYWkdRujgY0OyVdk+xuvuiwUNdn39iM8JG28hiW8KkuMMkI= X-Received: by 2002:a05:600c:21d3:: with SMTP id x19mr1695787wmj.174.1595461106549; Wed, 22 Jul 2020 16:38:26 -0700 (PDT) In-Reply-To: X-JS-Exim-Data-Received: 2020-07-22 19:38:28-0400 X-JS-Processed-by: mailcore Received-SPF: pass client-ip=38.105.200.78; envelope-from=mstanojevic@janestreet.com; helo=mxout1.mail.janestreet.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/22 19:38:30 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:253168 Archived-At: I submitted the bug report. https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D42482 I wonder if some kind of hybrid approach would work. Use the same representation like emacs-26 (emacs_value is Lisp_Object) but also have an array of emacs_values created in the environment (like in emacs-27) that can be used to mark them for garbage collection. Global storage wouldn't be necessary. On Mon, Jul 20, 2020 at 12:41 PM Milan Stanojevi=C4=87 wrote: > > This is on emacs-27 branch. > > env-make_global_ref will add a reference to the underlying Lisp_Object > and allocate 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. > > The global storage of emacs_values seems to be only growing and is > never collected (and I think with the current array implementation it > is probably not possible to collect). > > This leak is not present in 26 and I think the leak was introduced > with the change in the underlying representation of emacs_value. (If > I'm reading git history right, since 26 this was changed and then > reverted and then changed again).