Index: pylib/gyp/generator/ninja.py |
diff --git a/pylib/gyp/generator/ninja.py b/pylib/gyp/generator/ninja.py |
index 25f5780dd26a5f77ad9d27662cd904b1e39e8cfc..58ea28b7e520a05c1251c1d54a4d2a526452f6f7 100644 |
--- a/pylib/gyp/generator/ninja.py |
+++ b/pylib/gyp/generator/ninja.py |
@@ -1483,6 +1483,16 @@ def GetDefaultConcurrentLinks(): |
ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat)) |
return max(1, stat.ullTotalPhys / (4 * (2 ** 30))) # total / 4GB |
+ elif sys.platform.startswith('linux'): |
+ with open("/proc/meminfo") as meminfo: |
+ memtotal_re = re.compile(r'^MemTotal:\s*(\d*)\s*kB') |
+ for line in meminfo: |
+ match = memtotal_re.match(line) |
+ if not match: |
+ continue |
+ # Allow 8Gb per link on Linux because Gold is quite memory hungry |
+ return max(1, int(match.group(1)) / (8 * (2 ** 20))) |
Nico
2013/08/27 22:01:04
Isn't 2**20 a megabyte, not a gigabyte?
...ah, /p
|
+ return 1 |
else: |
# TODO(scottmg): Implement this for other platforms. |
return 1 |