Better memory usage in mk_array_file.py