Increase open file limit on Linux

Add some assertions to VirtualMemory.cpp
This commit is contained in:
Nekotekina 2018-05-13 22:50:38 +03:00
parent 3c70645f0b
commit a46ef4f29a
2 changed files with 34 additions and 7 deletions

View file

@ -13,6 +13,11 @@
#include <windows.h>
#endif
#ifdef __linux__
#include <sys/time.h>
#include <sys/resource.h>
#endif
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
template <typename... Args>
@ -85,6 +90,14 @@ int main(int argc, char** argv)
qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", "1");
#endif
#ifdef __linux__
struct ::rlimit rlim;
rlim.rlim_cur = 4096;
rlim.rlim_max = 4096;
if (::setrlimit(RLIMIT_NOFILE, &rlim) != 0)
std::fprintf(stderr, "Failed to set max open file limit (4096).");
#endif
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QCoreApplication::setAttribute(Qt::AA_DisableWindowContextHelpButton);