-
Notifications
You must be signed in to change notification settings - Fork 347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tempfile not deleted when using "format" #188
Conversation
I wrote a fix. Maybe somebody from core could review it, escpecially because it uses convert instead of mogrify (is this ok? - it's imho better suited for Image#format) - and moreover, someone could explain the use case for the existing yield to me: def format(...)
...
command = CommandBuilder.new(...)
yield(command) if block_given?
...
run command
...
end as it yields the command builder instance, which probably should not be made accessible to minimagick users directly imho?! However, here's the pull request |
Hi, what do you think about this PR? |
I thought it was up to the garbage collector and/or the operating system to clean up temporary files? Maybe we could make use of the open-block to help the GC clean up, eg.: # Short-term use
Tempfile.open('my_program') do |f|
puts "Tempfile opened at #{f.path}"
f.puts "Putting some text into the file"
end from http://ruby.about.com/od/beginningruby/a/dir4.htm Why do you think that convert is better than mogrify in a format situation? |
I thought it was up to the garbage collector and/or the operating system to clean up temporary files? Yes, but take a look to: require "mini_magick"
image = MiniMagick::Image.open("test.tif") # a)
image.format "jpg" # b) Here, we want minimagick to behave similar to: However, in master, minimagick currently does the following: Take a look into the source, no tempfile is touched in Why do you think that convert is better than mogrify in a format situation? Generally speaking, Moreover, if we use tempfiles (like we do for Image#open), Image#format must create |
+1 for accepting this pull request. I'm also seeing my /tmp directory fill up with mini_magick .jpg files in the same circumstances. Looks like this solution is well researched and works. |
This is problematic for me as well. Have the owners of this repo commented on this PR yet? |
+1 on having this merged. When dealing with tens of thousands of large objects, the leftover temporary files filled 60GB of space causing my image processing server to run out of storage. |
@mrkamel can you rebase this? It doesn't merge cleanly. Then, 👍 for merging into master. |
Done. However, Travis currently does not seem to work in general for rbx and jruby-head. |
oops, don't know what happened in commit 7af2cd4. i'll create a new, fresh PR. |
I'm using 3.7.0.
Minimagick leaves an additional tempfile in /tmp when using the "format" command.
such that my disk fills up.
Before i run
ruby test.rb
:ls /tmp/mini_magick*
gives 0 resultsAfterwards, i have a /tmp/mini_magick20131127-18504-ula55j.jpg that doesn't get deleted when the script terminates, etc.