From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Milan =?UTF-8?Q?Stanojevi=C4=87?= Newsgroups: gmane.emacs.bugs Subject: bug#42482: 27.0.91; emacs modules memory leak Date: Thu, 23 Jul 2020 10:29:08 -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="31932"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 42482-done@debbugs.gnu.org To: Philipp Stephani Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 23 16:31:09 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 1jycFZ-0008E8-BQ for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 23 Jul 2020 16:31:09 +0200 Original-Received: from localhost ([::1]:54576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jycFY-00038t-9K for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 23 Jul 2020 10:31:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45832) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jycEU-0001xB-UK for bug-gnu-emacs@gnu.org; Thu, 23 Jul 2020 10:30:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34217) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jycEU-0007B1-Je for bug-gnu-emacs@gnu.org; Thu, 23 Jul 2020 10:30:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jycEU-0002nJ-G1 for bug-gnu-emacs@gnu.org; Thu, 23 Jul 2020 10:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Milan =?UTF-8?Q?Stanojevi=C4=87?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Jul 2020 14:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42482 X-GNU-PR-Package: emacs Original-Received: via spool by 42482-done@debbugs.gnu.org id=D42482.159551459510703 (code D ref 42482); Thu, 23 Jul 2020 14:30:02 +0000 Original-Received: (at 42482-done) by debbugs.gnu.org; 23 Jul 2020 14:29:55 +0000 Original-Received: from localhost ([127.0.0.1]:45763 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jycEN-0002mY-DX for submit@debbugs.gnu.org; Thu, 23 Jul 2020 10:29:55 -0400 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]:48969) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jycEK-0002mI-JW for 42482-done@debbugs.gnu.org; Thu, 23 Jul 2020 10:29:54 -0400 X-JS-Received: from [30.40.81.8] (helo=tot-qpr-mailcore1) by mxout5.mail.janestreet.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.94) (envelope-from ) id 1jycEE-0000pN-VS for 42482-done@debbugs.gnu.org; Thu, 23 Jul 2020 10:29:46 -0400 X-JS-Flow: external X-JS-Received: by tot-qpr-mailcore1 with ocaml/mailcore/main_production (a856a1269fd0) (envelope-from ) id BfGZ7a-tJ-cQA-ci; 2020-07-23 10:29:46.959719-04:00 X-JS-Scanner-attachment: No attachments X-JS-Scanner-esets: Not scanned (internal mail) Original-Received: from mail-wm1-f72.google.com ([209.85.128.72]) by mxgoog2.mail.janestreet.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.94) id 1jycED-0000ig-HC for 42482-done@debbugs.gnu.org; Thu, 23 Jul 2020 10:29:45 -0400 Original-Received: by mail-wm1-f72.google.com with SMTP id f74so2598938wmf.1 for <42482-done@debbugs.gnu.org>; Thu, 23 Jul 2020 07:29:45 -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 :cc:content-transfer-encoding; bh=45kIpnI6TklTvpaXiKA8pfBcnltb7Q6T064NledhvEs=; b=MX9KhpiXwwNC1B2q9apHIQarh9PCITdY4McNQ3ERxrGfi3fht76xKXDFB4YclONk5u /qf9nAx4hkjKtILQM/IviGoJ1WrL1huma9rl41c3ZkOjWshv1lGcl9SsWeMNm+XOrYA7 RVYqDgT0ZM95Q5BcCoFjW8aVKypb3FUKjTRCA= 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=45kIpnI6TklTvpaXiKA8pfBcnltb7Q6T064NledhvEs=; b=YKFLSDvT9G4tS7YYQ+luU31zp7cpQbUYoxOLyP/QUH6Q+JbQi8dD4y24JvjVN7Xp+4 JhcFut12B2X116mE8aJw3LG3S8+mRBBzZ4or+trCdNbvOcwh1ENkFsQoQamyFn+rlpzW pkjy3LesSBOttTn6hceKE40gsh/D3bR1BumOXAnC6IlZuzT1mmzUu3XyAvvCKrEVeeO/ IEG2J1kaamXHxIpQvgQswvzjbHbs7Misu73zgXjNM7Z4avjm7RM79NVAWf/BaWB5w7Bo p48hw9qlFNdvojFvvIwJyVmSiloU9adY7eGY/5LQHHdGvePd7Rn/80vWbg/ZkJAOW62e E7wQ== X-Gm-Message-State: AOAM532FHPbVlvcd1lgzpv/mfDzFGk3y5d0fuLhzxOyoHQICwD7ZEmBH 3RKId6UKyYWbK0+5TZem1xYmYKk8zhqAv2f2OqNeu3ah25NNZjPiZNd0fOkQvjOt52wE3Rt4ULL jPgnz7qyNnEYIcsD21FSpoFIcE2Q15S9WJjSZ X-Received: by 2002:adf:97dc:: with SMTP id t28mr4015466wrb.291.1595514584674; Thu, 23 Jul 2020 07:29:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVKnifs9z29KyeSdLz1O0ciYeeagn1TbrwXQrIC1uFfHfnNM8B3e83zUIcU++iMxTX10CyXgmoYpaEsgm47xc= X-Received: by 2002:adf:97dc:: with SMTP id t28mr4015449wrb.291.1595514584419; Thu, 23 Jul 2020 07:29:44 -0700 (PDT) In-Reply-To: X-JS-Exim-Data-Received: 2020-07-23 10:29:45-0400 X-JS-Processed-by: mailcore 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:183431 Archived-At: Thank you for the quick fix. Is there a chance this also goes to emacs-27 branch so it can be in the emacs 27.1 when it gets released? On Thu, Jul 23, 2020 at 8:07 AM Philipp Stephani wr= ote: > > 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_t= est.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.