Subject: bug#76069: 31.0.50; Hash tables not collected

From: Helmut Eller <[email-masked]>
Date: Wed, 05 Feb 2025 15:36:44 +0100

If the current feature/igc branch is configured without MPS, then it
seems that hash tables aren't collected properly.  When executing this
file

;;; -*- lexical-binding: t -*-

(defun hash-integers (n)
  (let ((table (make-hash-table :test 'eql)))
    (dotimes (i n)
      (puthash i i table))))

(defun main ()
  (dotimes (_ 300)
    (hash-integers 100000))
  (kill-emacs))

;; EOF

with:  /usr/bin/time emacs -Q -batch -l httest.el -f main

I see:

15.35user 2.40system 0:35.18elapsed 50%CPU (0avgtext+0avgdata 2429884maxresident)k
65152inputs+0outputs (443major+675016minor)pagefaults 0swaps

This is the output of GNU time (not the bash builtin).  Note the ~2.3GB
maxresident.  Also, when I set a breakpoint in gdb at alloc.c:3389 it is
hit only once while executing this file.

In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.16.0) of 2025-02-05 built on caladan
Repository revision: 4c97d39b16a75411ccfdcf16d0871a77ff41785c
Repository branch: feature/igc
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure --with-mps=no --with-xpm=ifavailable --with-gif=ifavailable
 --with-native-compilation=no 'CFLAGS=-g -O2 -fno-omit-frame-pointer
 --std=gnu99 -I/scratch/emacs/mps-install/include
 -L/scratch/emacs/mps-install/lib''

Configured features:
CAIRO DBUS FREETYPE GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LIBSELINUX
LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUND
SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM
XINPUT2 GTK3 ZLIB

Important settings:
  value of $LANG: C.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  whitespace-mode: t
  outline-minor-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  minibuffer-regexp-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t