Memory leak when stay_open is used

Started by MOL, January 29, 2012, 10:16:24 PM

Previous topic - Next topic

MOL

Hi Phil and Bogdan

Windows Vista Home Premium 32bit (all updates applied), latest ExifTool version, latest ExifTool GUI version:

It seems that ExifTool doesn't release used memory after switching from one file to the next when in stay_open mode. I'm experiencing a slow, but constant increase in memory consumption when I use ExifTool GUI and browse through the files of a folder.

Steps to reproduce:

a) Start the Task Manager with CTRL + ALT + DEL and switch to the Processes tab
b) Start ExifTool GUI
c) Navigate to a folder with many image files
d) Jump back and forth between files and display their metadata
e) Watch the memory usage of the ExifTool process slowly increasing

Thx
Uwe

Phil Harvey

Hi Uwe,

Thanks for this report.

Does the memory usage continue to increase when reprocessing the same files?

It is normal for the memory usage to increase when processing a different type of file if a new module must be loaded for this type of file.

I can't try this on the PC right now, but I just tried here on my Mac using -stay_open to process a directory containing a variety of file types with no other arguments.  The exiftool process starts at 5 MB, then grows as I process each file.  When I am done the 160 files in the directory the memory usage is 37.12 MB.  After processing the entire directory again the memory usage is 38.03 MB.  Then I can process the directory as many times as I want after this and the memory usage stays at 38.03 MB.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

MOL

Hi Phil

I wasn't aware that ExifTool loads only the modules it needs instead of loading everything into memory up front. That's of course the explanation for the increase in memory usage I'm seeing. I can confirm what you've described for the Mac system, although I've noticed that loading JPG's from different camera manufacturers increases the memory consumption of ExifTool each time as well. Are there different JPG modules resident? Sorry for asking, but I'm not very good at PERL...

Thanks
Uwe

Phil Harvey

Hi Uwe,

Glad to hear this was likely the reason.

Yes, there are different modules for processing the makernotes from different manufacturers.  Also, different modules for writing information, language translations, and character encodings.  The modules are loaded only as necessary, and once loaded they aren't released until the program quits.

The full list of modules is best seen on the CPAN Image-ExifTool web page.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

BogdanH

Hi,

I've done a quick check on my PC, without "analyzing" much. I won't comment much on ExifTool's memory usage, because I have no idea how it works. Yes, mem usage increases a bit during time, but not "that" much -so I don't see this increase serious. Anyway, everytime user changes working directory, ExifTool is "re-connected" with GUI and mem usage starts at initial level.
As one might notice, GUI's memory consumtion also increases a bit during time and probably stops at some level -and I don't have much influence on that. I would say, OS has it's own logic on memory management as well..

Bogdan

MOL

#5
Hi Phil

Thanks a lot for the link. I'm glad that it turned out to be a non-issue.


Quote from: BogdanH on January 30, 2012, 01:54:26 PM
Yes, mem usage increases a bit during time, but not "that" much -so I don't see this increase serious. As one might notice, GUI's memory consumtion also increases a bit during time and probably stops at some level -and I don't have much influence on that.

Yup, the best way to deal with memory leaks (real or suspected ones): just ignore them...  :)

Sorry, couldn't resist.


Uwe