Skip to content

Commit 3e39c73

Browse files
committed
changed to use free memory instead of total memory
1 parent 12cd730 commit 3e39c73

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

depthai-core

Submodule depthai-core updated 56 files

setup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,14 @@ def build_extension(self, ext):
117117
build_args += ['--config', cfg]
118118

119119
# Memcheck (guard if it fails)
120-
totalMemory = 4000
120+
freeMemory = 4000
121121
if platform.system() == "Linux":
122122
try:
123-
totalMemory = int(os.popen("free -m").readlines()[1].split()[1])
123+
freeMemory = int(os.popen("free -m").readlines()[1].split()[2])
124124
except (KeyboardInterrupt, SystemExit):
125125
raise
126126
except:
127-
totalMemory = 4000
127+
freeMemory = 4000
128128
# Memcheck (guard if it fails)
129129

130130

@@ -151,10 +151,10 @@ def build_extension(self, ext):
151151
os.environ['_PYTHON_HOST_PLATFORM'] = re.sub(r'macosx-[0-9]+\.[0-9]+-(.+)', r'macosx-10.9-\1', util.get_platform())
152152

153153
# Specify how many threads to use when building, depending on available memory
154-
if totalMemory < 1000:
154+
if freeMemory < 1000:
155155
build_args += ['--', '-j1']
156156
cmake_args += ['-DHUNTER_JOBS_NUMBER=1']
157-
elif totalMemory < 2000:
157+
elif freeMemory < 2500:
158158
build_args += ['--', '-j2']
159159
cmake_args += ['-DHUNTER_JOBS_NUMBER=2']
160160
else:

0 commit comments

Comments
 (0)