I have tried running the official Fedora build of emacs under valgrind. It very quickly errors out due to thinking it has run out of memory. This is a known issue mentioned in the Valgrind documentation.

The Valgrind documentation says to rebuild emacs with system malloc, so I tried rebuilding emacs from the Fedora srpm, modifying the configure file to set system_malloc=yes always. But this has the same issue - it turns out that my modification didn't take effect because configure gets overwritten by make bootstrap.

So then I modified both configure.ac and configure in the same way. This segfaults during the build.

I then ran the bootstrap version of emacs (the one that was segfaulting during the build) under Valgrind, which produced what are described as spurious errors. It turns out that dumping doesn't work with Valgrind, so it's recommended to run temacs instead of emacs.

However, I tried running temacs from the incomplete build, but it failed to start:

Loading loadup.el (source)...
Using load-path (/home/robin/rpmbuild/BUILD/emacs-25.1/build-gtk/../lisp)
Loading emacs-lisp/byte-run (source)...
Loading emacs-lisp/byte-run (source)...done
Loading emacs-lisp/backquote (source)...
Loading emacs-lisp/backquote (source)...done
Loading subr (source)...
Loading subr (source)...done
Loading version (source)...
Symbol’s function definition is void: pcase

In etc/DEBUG in the emacs source, the following advice is given:

** Running Emacs built with malloc debugging packages

If Emacs exhibits bugs that seem to be related to use of memory allocated off the heap, it might be useful to link Emacs with a special debugging library, such as Electric Fence (a.k.a. efence) or GNU Checker, which helps find such problems.

Emacs compiled with such packages might not run without some hacking, because Emacs replaces the system's memory allocation functions with its own versions, and because the dumping process might be incompatible with the way these packages use to track allocated memory. Here are some of the changes you might find necessary:

  • Edit configure, to set system_malloc and CANNOT_DUMP to "yes".

  • Configure with a different --prefix= option. If you use GCC, version 2.7.2 is preferred, as some malloc debugging packages work a lot better with it than with 2.95 or later versions.

  • Type "make" then "make -k install".

  • If required, invoke the package-specific command to prepare src/temacs for execution.

  • cd ..; src/temacs

(Note that this runs 'temacs' instead of the usual 'emacs' executable. This avoids problems with dumping Emacs mentioned above.)

However, these instructions are not detailed enough to be self-contained - I don't understand how to follow these instructions - beyond setting system_malloc to yes, which I have done.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.