python - Memory leak when using py7zlib to open .7z archives -
i trying use py7zlib open , read files stored in .7z archives. able this, appears causing memory leak. after scanning through few hundred .7z files using py7zlib, python crashes memoryerror. don't have problem when doing equivalent operations on .zip files using built-in zipfile library. process .7z files follows (look subfile in archive given name , return contents):
with open(filename, 'rb') f: z = py7zlib.archive7z(f) names = z.getnames() if subname in names: subfile = z.getmember(subname) contents = subfile.read() else: contents = none return contents
does know why causing memory leak once archive7z object passes out of scope if closing .7z file object? there kind of cleanup or file-closing procedure need follow (like zipfile library's zipfile.close())?
Comments
Post a Comment