There is no memory leak. This is just a JavaScript garbage collection problem.
Basically, to copy a file the script loads its contents in memory and then writes them to the destination file. Although the script does this by chunks of 1 MiB, the JavaScript engine optimizes the process for pure execution speed by not releasing any of the ByteArray objects used to load file data. As a result, you end up with the whole data of a large set of image files plus lots of auxiliary structures allocated in RAM and, when RAM exhausts, in virtual memory.
Revising the script's source code, I see where this problem can be fixed very easily. I'll write to Mike to see if we can fix this issue as soon as possible. Sorry for the inconvenience.