David Monniaux wrote:
> Hi all,
> Many people around here complain that Gimp leaves enormous swap files when
> crashing. It is especially a pain since they are in a "hidden"
> Would it be possible to have Gimp unlink() the files after opening them?
> I explain: if we use swap files as follow: open them at the beginning and
> never close them until the end of execution of Gimp, then if we unlink()
> them after opening them they will get erased when Gimp exits, whether it
> exists gracefully or not.
> I don't know how swapping works in Gimp, so feel free to point me out the
> obvious reason why it doesn't work. :-)
> [There's another method: use a wrapper script that erases the files
> afterwards. That's workable, but not foolproof: if somebody launches two
> Gimp sessions simultaneously, that'll lead to mysterious problems.
> Also, yes I know swap files should go to a local filesystem, but even if
> we do that then we'd end up with tons of swap files in /var/tmp.]
If we unlink the swap file after opening it then we have no way of knowing how
much space gimp is using for it's swap file.
I think unlinking the swap files in the signal handler that is called when we
crash would solve this problem. The cases where this will not work should be
rare enough not to worry about.