I use pyexiv2 library to read image exif info.and I found the ImageMetadata.from_buffer() method will lead memory leak when the image is not intact. But the ImageMetadata() method is ok.
The code below is my test code, and when I let it read from a file which not image, you will see the memory is not free.
import pyexiv2
import time
import sys
import os
def read_metadata(file_data):
try:
metadata = pyexiv2.ImageMetadata(file_data)
metadata = pyexiv2.ImageMetadata.from_buffer(file_data)
metadata.read()
except Exception,e:
print e
filename = sys.argv[1]
print filename
write_metadata(open(filename).read())
time.sleep(10000)