Scan large source repos

I have a parent folder and 28 sub folders that I am trying to source code scan. We wrote a script to navigate to each sub folders - If I scan the parent folder I get memory error. Wrote a script to navigate to each sub folder. Is this the right way to scan?

export PATH=“/Users/xxx/sonar-scanner-$PATH”

for dir in */; do
if [ -d “$dir” ]; then
(cd “$dir” && sonar-scanner


This isn’t ideal. You’ll likely not get the SCM data you need to properly identify new code and attribute issues.

What’s the memory error? Can you increase memory to the scanner?