I have a script that should index whole Camera Roll (11k pictures) - it iterates the pictures and computes a hash of each. After around 1300 pictures, iOS kills Pythonista. How to prevent that?
Forum Archive
Prevent iOS from killing Pythonista
@MichalOprendek perhaps you don'T free used memory after each processed photo. If not too long, could you posT your code?
Hi, it is here
https://cloud.oprendek.sk/index.php/s/y2on5Wxx5xnc5cG
Changes:
- I removed the links as they are not password-protected
- Meanwhile I added processed_idx dict to avoid hashing the files again and again (uses local_id instead) to overcome the problem...
Now uploading fails after some time but thanks to the latter it is easily restartable.
@MichalOprendek perhaps del data when no more needed in the loop
When processing camera roll, it is important to use an autorelease pool, and also you need to clear cached methods in the objects, due to a pythonista bug that creates reference cycles and prevents gc from running.
https://forum.omz-software.com/topic/7118/script-crashes-when-making-bulk-upload-into-local-server-synology-nas/6
.