File tree Expand file tree Collapse file tree
third_party/tcmalloc/dist/tcmalloc Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -496,6 +496,8 @@ class LinuxSysHelper {
496496 if (f != nullptr ) {
497497 if (fgets (fstr, 1023 , f) != nullptr )
498498 fstr[strlen (fstr) < 1 ? 0 : strlen (fstr) - 1 ] = ' \0 ' ;
499+ else
500+ fstr[0 ] = ' \0 ' ;
499501 fclose (f);
500502 }
501503 return fstr;
Original file line number Diff line number Diff line change @@ -43,6 +43,8 @@ std::string parseLineFromFile(const char* fname) {
4343 if (f != nullptr ) {
4444 if (fgets (fstr, 1023 , f) != nullptr )
4545 fstr[strlen (fstr) < 1 ? 0 : strlen (fstr) - 1 ] = ' \0 ' ;
46+ else
47+ fstr[0 ] = ' \0 ' ;
4648 fclose (f);
4749 }
4850
@@ -69,7 +71,8 @@ unsigned long long getMemorySizeLimitInBytes() {
6971 unsigned long long groupMemBytes = 0 ;
7072 std::string groupLimit = parseLineFromFile (file);
7173
72- if (!groupLimit.empty () ) {
74+ // The "max" value in cgroups v2 means no limit.
75+ if (!groupLimit.empty () && groupLimit != " max" ) {
7376 return std::min (systemMemBytes, (unsigned long long )atoll (groupLimit.c_str ()));
7477 }
7578 }
You can’t perform that action at this time.
0 commit comments