summaryrefslogtreecommitdiffstats
path: root/yql/essentials/utils/mem_limit.cpp
diff options
context:
space:
mode:
authorvvvv <[email protected]>2025-10-06 11:26:09 +0300
committervvvv <[email protected]>2025-10-06 11:53:26 +0300
commit60f45e69a4d7dbc6131208e16c45faf35aa5a985 (patch)
tree4daa45b52c295a178c7620e4c93921465fcf7950 /yql/essentials/utils/mem_limit.cpp
parent1bded1a65a7e6e9171418f3e1c691d390125b64e (diff)
YQL-20086 utils
init commit_hash:54feccd520ebd0ab23612bc0cb830914dff9d0e8
Diffstat (limited to 'yql/essentials/utils/mem_limit.cpp')
-rw-r--r--yql/essentials/utils/mem_limit.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/yql/essentials/utils/mem_limit.cpp b/yql/essentials/utils/mem_limit.cpp
index 87a0db833e3..6f03f796c82 100644
--- a/yql/essentials/utils/mem_limit.cpp
+++ b/yql/essentials/utils/mem_limit.cpp
@@ -1,5 +1,5 @@
#ifdef __unix__
-#include <sys/resource.h>
+ #include <sys/resource.h>
#endif
#include <util/generic/yexception.h>
@@ -9,21 +9,21 @@ namespace NYql {
void SetAddressSpaceLimit(ui64 memLimit) {
if (memLimit) {
- #ifdef __unix__
- auto memLimitBytes = memLimit * 1024 * 1024;
+#ifdef __unix__
+ auto memLimitBytes = memLimit * 1024 * 1024;
- struct rlimit rl;
- if (getrlimit(RLIMIT_AS, &rl)) {
- throw TSystemError() << "Cannot getrlimit(RLIMIT_AS)";
- }
+ struct rlimit rl;
+ if (getrlimit(RLIMIT_AS, &rl)) {
+ throw TSystemError() << "Cannot getrlimit(RLIMIT_AS)";
+ }
- rl.rlim_cur = memLimitBytes;
- if (setrlimit(RLIMIT_AS, &rl)) {
- throw TSystemError() << "Cannot setrlimit(RLIMIT_AS) to " << memLimitBytes << " bytes";
- }
- #else
- throw yexception() << "Memory limit can not be set on this platfrom";
- #endif
+ rl.rlim_cur = memLimitBytes;
+ if (setrlimit(RLIMIT_AS, &rl)) {
+ throw TSystemError() << "Cannot setrlimit(RLIMIT_AS) to " << memLimitBytes << " bytes";
+ }
+#else
+ throw yexception() << "Memory limit can not be set on this platfrom";
+#endif
}
}