From e8a0bc579489e728faf3839b88b6536a89c560da Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Tue, 19 Mar 2019 16:50:08 +0300 Subject: [PATCH] android: reduce memory consumption by gradle builds --- platforms/android/build_sdk.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/platforms/android/build_sdk.py b/platforms/android/build_sdk.py index c779de3ec2..929d94aec5 100755 --- a/platforms/android/build_sdk.py +++ b/platforms/android/build_sdk.py @@ -231,7 +231,10 @@ class Builder: cmd += [ "-D%s='%s'" % (k, v) for (k, v) in cmake_vars.items() if v is not None] cmd.append(self.opencvdir) execute(cmd) - execute([self.ninja_path, "install" if self.debug else "install/strip"]) + # full parallelism for C++ compilation tasks + execute([self.ninja_path, "opencv_modules"]) + # limit parallelism for Gradle steps (avoid huge memory consumption) + execute([self.ninja_path, '-j3', "install" if self.debug else "install/strip"]) def build_javadoc(self): classpaths = []