Skip to content

Commit d304c7b

Browse files
set num_of_process to a feasible value (#312)
* set num_of_process to a feasible value * FIxed: called the function. called the function instead of a referencing it. Co-authored-by: haeter525 <[email protected]>
1 parent 64fa2f3 commit d304c7b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

quark/core/parallelquark.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# See the file 'LICENSE' for copying permission.
44

55
from multiprocessing.pool import Pool
6+
from multiprocessing import cpu_count
67

78
from quark.core.analysis import QuarkAnalysis
89
from quark.core.quark import Quark
@@ -93,7 +94,8 @@ def _apply_analysis_result(self, rule_obj):
9394
for behavior in result[2]
9495
]
9596

96-
analysis.level_5_result = [behavior[0] for behavior in behavior_list]
97+
analysis.level_5_result = [behavior[0]
98+
for behavior in behavior_list]
9799

98100
analysis.call_graph_analysis_list.extend(
99101
[
@@ -113,7 +115,8 @@ def _apply_analysis_result(self, rule_obj):
113115
def __init__(self, apk, core_library, num_of_process=1):
114116
self._result_map = {}
115117
self._pool = Pool(
116-
num_of_process - 1, self._worker_initializer, (apk, core_library)
118+
min(num_of_process, cpu_count() - 1), self._worker_initializer,
119+
(apk, core_library)
117120
)
118121

119122
super().__init__(apk, core_library)

0 commit comments

Comments
 (0)