After some time the scan-photos process starts consuming a lot of memory and the amount increases even more over the time.
This is a screenshot from htop running on my Nextcloud host:

and some time later:

This leads to crashing of the process on my machine with 2GB of RAM after scanning around 32k pictures.
[1] 19349 killed sudo -u www-data php /var/www/nextcloud/occ maps:scan-photos marco
Is it possible to run the job with a set memory limit?