jimeh / build-emacs-for-macos

Somewhat hacky script to automate building of Emac.app on macOS.
480 stars 51 forks source link

Add configuration options for increasing max open files #106

Open jesse-c opened 3 months ago

jesse-c commented 3 months ago

For some reason, only recently I've started to get errors in Emacs around max open files. It's most likely due to a combination of the files and projects open, my usage of LSP, and other things.

From looking around, it looks like Emacs doesn't adhere to the system level max open file limits, due to where it pulls the numbers for those from. A fix is to set the configuration options of FD_SETSIZE and DARWIN_UNLIMITED_SELECT [1].

If this sounds reasonable, I'm happy to create a PR to add it to https://github.com/jimeh/build-emacs-for-macos/blob/master/build-emacs-for-macos.

I use https://github.com/jimeh/emacs-builds, so I suppose the next question is, if the configuration options were added, would they bet set as defaults?

PS. Thank you for this project!

[1] https://en.liujiacai.net/2022/09/03/emacs-maxopenfiles/

jimeh commented 3 months ago

I've had a look at this before, but I don't really remember much about it anymore... lol 😅

But I did add a --poll option that applies a patch for the experimental poll feature mentioned at the end of the article you linked to. But I don't recall why I didn't add an alternative option for the FD_SETSIZE approach.

With the poll patch though, I vaguely recall having some issues with it, which I believe is why it never became a default. I'll give it a try again over the next few days and see how things look.

That said, I do think it would still be useful to have the FD_SETSIZE approach available as an alternative option in the build script. I probably won't have much spare time till the weekend though, so a PR would be appreciated if you've got time :)

jesse-c commented 3 months ago

Haha, no worries! I can see the --poll option now! [1] There's no rush at all. I'll see if I can get my head around the codebase and can knock something out for it.

Thank you for the quick reply!

[1] https://github.com/jimeh/build-emacs-for-macos/commit/a3530c02e8260106f87d464e5cb398dcb2819460

jesse-c commented 3 months ago

I've got a patch working on my machine! I'll create a PR for it.

jesse-c commented 3 months ago

Done! See: https://github.com/jimeh/build-emacs-for-macos/pull/107.