"Too Many Files Open"

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
morfanaion

"Too Many Files Open"

Post by morfanaion »

I've been having a problem with a program at work that uses ImageMagick to save OpenGLbuffers to disk and later convert the saved images to other formats.

After about 14 hours, in which about 15000 or more images were saved and converted, I get an error message from ImageMagick that says that there are too many files open and the program aborts. This particular program needs to run as long as possible, preferably at least several days, but with the current 14 hours, that goal is hardy within reach.

Anyone has any idea why this message would pop up? We are programming in C++ and, with just a few minor exceptions, all image objects that we create are declared as objects (not pointers), which means that they ought to be destroyed by the end of the function call. I've checked for leaks in the cases where we do create the objects dynamically, but those are all deleted once they are no longer needed. Anyone?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: "Too Many Files Open"

Post by magick »

The exception suggests there is a file leak in ImageMagick or an image object leak in your program (image being created but not destroyed). We did identify one file leak about 6 months ago. Can you test your program with the latest ImageMagick release, 6.5.4-0, which does not have any known file leaks. If you do and still see a leak (and you are sure you are destroying all image objects after they are no longer needed) we will need your help to identify where the leak occurs and apply a patch.
morfanaion

Re: "Too Many Files Open"

Post by morfanaion »

I don't know if there have been any changes on the file leak front since version 6.5.3-1, but that's the version I'm currently running on the machine that is reporting the problem, or at least, that's what "convert --version" is reporting.

In any case, in order to determin conditions under which the error occurs, I've tried various pieces of code that ought to trigger it. Right now I've got a program running that recursively calls a function that creates an Image and reads a file from disk (always the same file), before calling itself again. Right now it has about 40000 files open and I still don't get the message. How many files does ImageMagick allow me to open simultaniously?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: "Too Many Files Open"

Post by magick »

The number of permitted open file descriptors is defined by your OS, not ImageMagick. It is generally around 1024.
Post Reply