On 2025-01-16 13:46, Hong Xu wrote: > After applying the patch to the master branch, I'm getting a memory > exhaustion error when starting Emacs: Oh, I was assuming sane malloc/realloc behavior and you tested on a platform which doesn't do that. Gnulib fixes that and I thought Emacs was already using Gnulib for this, but I now see that Emacs uses Gnulib to fix only malloc, not realloc. Please try the attached two patches instead. The first one arranges for Emacs to also fix realloc. The second one is the same patch that I gave you earlier, the patch that simplifies the lrealloc code. The MS-Windows port already fixes malloc and realloc in a different way, so the first patch should affect only non-MS-Windows platforms.