1

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)
Cœur
  • 37,241
  • 25
  • 195
  • 267
  • Possible duplicate of [pyexiv2 get image exif, from\_buffer function lead memory leak](https://stackoverflow.com/questions/31828200/pyexiv2-get-image-exif-from-buffer-function-lead-memory-leak) – Cœur Aug 20 '17 at 06:09

0 Answers0