GNU bug report logs - #42482
27.0.91; emacs modules memory leak

Previous Next

Package: emacs;

Reported by: Milan Stanojević <mstanojevic <at> janestreet.com>

Date: Wed, 22 Jul 2020 23:27:02 UTC

Severity: normal

Found in version 27.0.91

Done: Philipp Stephani <p.stephani2 <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Milan Stanojević <mstanojevic <at> janestreet.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.91; emacs modules memory leak
Date: Wed, 22 Jul 2020 19:25:19 -0400
[Message part 1 (text/plain, inline)]
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=c99 -I <dir-with-emacs-module.h>
create_global_refs.c -o create_global_refs.so
$ emacs --no-splash -q -l create_global_refs.so -l create_global_refs_test.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.
[create_global_refs.c (text/x-csrc, attachment)]
[create_global_refs_test.el (text/x-emacs-lisp, attachment)]

This bug report was last modified 4 years and 291 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.