Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation takes an ungodly amount of RAM now #59424

Closed
NetSysFire opened this issue Jul 19, 2022 · 6 comments
Closed

Compilation takes an ungodly amount of RAM now #59424

NetSysFire opened this issue Jul 19, 2022 · 6 comments
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Build Issues regarding different builds and build environments Code: Debug Debugging and troubleshooting the game, also includes the debug menu Code: Performance Performance boosting code (CPU, memory, etc.) OS: Linux Issues related to Linux operating system (S2 - Confirmed) Bug that's been confirmed to exist

Comments

@NetSysFire
Copy link
Member

Describe the bug

I have a system with 8 GB of DDR4 RAM to compile and usually use -j 10 for that (Ryzen 1600af, 12 threads), which is not possible anymore. However it works for basically any other project and used to work in the past.

Steps to reproduce

  1. Compile with -j10.
  2. Your system freezes because it fills up the RAM so quickly the OOM killer can not even react.

Expected behavior

It does not use this large amount of RAM. It worked with -j10 until the item* files, so the cause may be somewhere around there. I am assuming there might be a recent regression.

I am currently using -j6 which means it peaks at about 4 GB of RAM.

Screenshots

No response

Versions and configuration

  • OS: Arch Linux
  • Compiler: GCC 12

Additional context

No response

@NetSysFire NetSysFire added Code: Performance Performance boosting code (CPU, memory, etc.) (S1 - Need confirmation) Report waiting on confirmation of reproducibility Code: Build Issues regarding different builds and build environments OS: Linux Issues related to Linux operating system labels Jul 19, 2022
@NetSysFire
Copy link
Member Author

After some discussion on the IRC and additional light debugging, I have come to the conclusion that certain files are simply too big. Examples include cata_tiles.o, certain inventory stuff, activity_actor.o. Considering that I used to be able to compile without memory issues, this is still a regression.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.

@github-actions github-actions bot added the stale Closed for lack of activity, but still valid. label Mar 7, 2023
@NetSysFire NetSysFire added (S2 - Confirmed) Bug that's been confirmed to exist [C++] Changes (can be) made in C++. Previously named `Code` Code: Debug Debugging and troubleshooting the game, also includes the debug menu and removed (S1 - Need confirmation) Report waiting on confirmation of reproducibility stale Closed for lack of activity, but still valid. labels Mar 27, 2023
@NetSysFire
Copy link
Member Author

I have found out why: LTO. I "only" have 8 GB RAM and that also makes debugging with gdb impossible, as loading the symbols will take up more than 8 GB (see https://bbs.archlinux.org/viewtopic.php?pid=2092119).

A gdb dev could confirm the memory usage of trying to load symbols.
CC @kevingranade, as he appears to be interested in optimization.

@anothersimulacrum
Copy link
Member

Compiling with 40 cores with gcc takes significantly more memory (30-ish gigs?) than clang (10-ish) on my machine.

@svenstaro
Copy link
Contributor

Is this still relevant?

@kevingranade
Copy link
Member

While reducing memory footprint while compiling is a nice to have, we have no target build system requirements and therefore this is not a regression per se.
Workaround, just reduce the argument you pass to -j

I'm not completely hostile to a check along the lines of, "no compilation unit should consume more than X MB of RAM with ", but also I wouldn't expect lto to be on the given compiler options, especially as it makes linking take absolutely ungodly amounts of RAM, and if someone is interested in pushing that forward they need to provide the tooling to support it.

@kevingranade kevingranade closed this as not planned Won't fix, can't repro, duplicate, stale Nov 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Build Issues regarding different builds and build environments Code: Debug Debugging and troubleshooting the game, also includes the debug menu Code: Performance Performance boosting code (CPU, memory, etc.) OS: Linux Issues related to Linux operating system (S2 - Confirmed) Bug that's been confirmed to exist
Projects
None yet
Development

No branches or pull requests

4 participants