Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(632)

Side by Side Diff: pylib/gyp/generator/ninja.py

Issue 132273002: Speculative fix for OOM on win ninja builders (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2013 Google Inc. All rights reserved. 1 # Copyright (c) 2013 Google Inc. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import copy 5 import copy
6 import hashlib 6 import hashlib
7 import json 7 import json
8 import multiprocessing 8 import multiprocessing
9 import os.path 9 import os.path
10 import re 10 import re
(...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 ("ullAvailVirtual", ctypes.c_ulonglong), 1550 ("ullAvailVirtual", ctypes.c_ulonglong),
1551 ("sullAvailExtendedVirtual", ctypes.c_ulonglong), 1551 ("sullAvailExtendedVirtual", ctypes.c_ulonglong),
1552 ] 1552 ]
1553 1553
1554 stat = MEMORYSTATUSEX() 1554 stat = MEMORYSTATUSEX()
1555 stat.dwLength = ctypes.sizeof(stat) 1555 stat.dwLength = ctypes.sizeof(stat)
1556 ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat)) 1556 ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat))
1557 1557
1558 mem_limit = max(1, stat.ullTotalPhys / (4 * (2 ** 30))) # total / 4GB 1558 mem_limit = max(1, stat.ullTotalPhys / (4 * (2 ** 30))) # total / 4GB
1559 hard_cap = max(1, int(os.getenv('GYP_LINK_CONCURRENCY_MAX', 2**32))) 1559 hard_cap = max(1, int(os.getenv('GYP_LINK_CONCURRENCY_MAX', 2**32)))
1560 return min(mem_limit, hard_cap) 1560 # return min(mem_limit, hard_cap)
1561 # TODO(scottmg): Temporary speculative fix for OOM on builders
Nico 2014/01/09 20:22:00 tracking bug for doing this right?
1562 return 2
1561 elif sys.platform.startswith('linux'): 1563 elif sys.platform.startswith('linux'):
1562 with open("/proc/meminfo") as meminfo: 1564 with open("/proc/meminfo") as meminfo:
1563 memtotal_re = re.compile(r'^MemTotal:\s*(\d*)\s*kB') 1565 memtotal_re = re.compile(r'^MemTotal:\s*(\d*)\s*kB')
1564 for line in meminfo: 1566 for line in meminfo:
1565 match = memtotal_re.match(line) 1567 match = memtotal_re.match(line)
1566 if not match: 1568 if not match:
1567 continue 1569 continue
1568 # Allow 8Gb per link on Linux because Gold is quite memory hungry 1570 # Allow 8Gb per link on Linux because Gold is quite memory hungry
1569 return max(1, int(match.group(1)) / (8 * (2 ** 20))) 1571 return max(1, int(match.group(1)) / (8 * (2 ** 20)))
1570 return 1 1572 return 1
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
2136 arglists.append( 2138 arglists.append(
2137 (target_list, target_dicts, data, params, config_name)) 2139 (target_list, target_dicts, data, params, config_name))
2138 pool.map(CallGenerateOutputForConfig, arglists) 2140 pool.map(CallGenerateOutputForConfig, arglists)
2139 except KeyboardInterrupt, e: 2141 except KeyboardInterrupt, e:
2140 pool.terminate() 2142 pool.terminate()
2141 raise e 2143 raise e
2142 else: 2144 else:
2143 for config_name in config_names: 2145 for config_name in config_names:
2144 GenerateOutputForConfig(target_list, target_dicts, data, params, 2146 GenerateOutputForConfig(target_list, target_dicts, data, params,
2145 config_name) 2147 config_name)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698