in reply to Clearing memory

If you insist on processing only ten files at a time, I think your best bet is to break the script apart into two pieces: One that processes those filenames that it gets on the command line and one that does the find, gets the list of filenames and calls the other script for groups of ten files.