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

Doesn't compile with 4GB of RAM #67

Closed
savely-krasovsky opened this issue Feb 10, 2018 · 4 comments
Closed

Doesn't compile with 4GB of RAM #67

savely-krasovsky opened this issue Feb 10, 2018 · 4 comments

Comments

@savely-krasovsky
Copy link

savely-krasovsky commented Feb 10, 2018

Can't compile it on small VPS with 1GB. But it compiles well with 6GB and 8GB. Is it really nesessary to have at least 6GB of RAM for compiling TDLib?

@levlam
Copy link
Contributor

levlam commented Feb 11, 2018

C++ compilers need enormous amount of resources for compilation nowadays. We have done many source code optimizations to decrease memory consumption and compilation time, but not so much depends on us here. The memory consumption grows very fast even on very simple code.
For now it should be enough 1.5-2 GB to build TDLib using clang or MSVC and 3.5-4 GB is needed for g++.

Between, what compiler/CMake version you are using?

@savely-krasovsky
Copy link
Author

@levlam I use g++, will try clang.
On my server with 4GB of RAM it suspended on compiling ContactsManager.cpp file. I waited for many hours, but with no success.

Then I have deployed VM with 6GB and watched RAM use. And confirmed that when ContactsManager.cpp compiling it uses nearly 4270 MB on Debian 9 with g++ 6.3.

I didn't guess that it so gluttonous process!

@isopen
Copy link
Contributor

isopen commented Mar 1, 2018

You need to try ninja 😉
#6
Seriously, try setting limits in Linux.

P.S.
The main thing is not to break anything

@levlam
Copy link
Contributor

levlam commented May 1, 2019

TDLib 1.4.0 includes a lot of compilation memory usage optimizations and a new script SplitSource.php, which can be used to split some source code files before building the library to reduce maximum RAM usage per file at the expense of increased build time. In our tests clang 6.0 with libc++ required less than 500 MB of RAM per file and GCC 4.9/6.3 used less than 1 GB of RAM per file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants