GNOME Bugzilla – Bug 74478
Cannot handle swap size of near 2 Gig (swap leak?)
Last modified: 2005-01-13 01:57:23 UTC
I'm working on large 300 dpi images for my comic strip, and found out that Gimp likes to leak swap. It tries to hit the 2 Gig filesize limitation, and fails miserablly -- it complains that it can't fileseek a tile (number 22). Strange.
I cannot test this for the moment (I do not have 2 Gb free on any of my disks ;-) but I assume that you are right. The GIMP would need to handle large files correctly in order for this to work, and it should use 64-bit long integers for accessing the tiles in the swap file. It does not do that yet.
As a first step, I've added AC_SYS_LARGEFILE to configure.in in the HEAD branch so we get the correct defines for large file support.
I had a closer look and I think that the use of AC_SYS_LARGEFILE should be sufficient to make gimp handle swap files of > 2GB. The code uses off_t all over the place and AC_SYS_LARGEFILE changes this to be a 64 bit integer. I'd appreciate if someone could verify that large swap files work in current CVS (or gimp >= 1.3.6).
Obviously off_t wasn't used everywhere. Changed in the HEAD branch: 2002-06-12 Sven Neumann <sven@gimp.org> * app/base/tile-swap.c: use off_t to handle file offsets (#74478).
This should be fixed in gimp-1.3.8. I'd appreciate if someone would stress-test this a bit and report back so that we can close this report (or fix any remaining issues).
Finally come around to do some testign and there was still one variable that needed conversion to off_t. Now large swap files are handled correctly. I've tested with a swap file larger than 4 GB. I don't think we should attempt to fix this in the GIMP-1.2 branch. 2003-01-04 Sven Neumann <sven@gimp.org> * app/base/tile-swap.c (tile_swap_find_offset): use off_t to return the offset. Finally allows to handle swap files larger than 2 GB (fixes bug #74478).
*** Bug 102518 has been marked as a duplicate of this bug. ***
*** Bug 142920 has been marked as a duplicate of this bug. ***
I have reopened this bug, because this does not work with Gimp on Win32. The swap file grows until 2GB is reached and then it gives the error "Unable to seek to tile location on disk: Invalid argument". Steps to reproduce: 1. Create a new image with 30000x30000 pixels 2. Wait until the above error message is displayed
You should probably file a bug report against MS windows for not being POSIX compliant then. I suggest that if you need to use large swap that you get a real operating system. Alternatively you could write up a patch against glib that makes the newly added stdio wrappers deal with this. We will switch to g_open() and friends for GIMP 2.4 so that's where this would have to be fixed. Please file an enhancement request against GLib.
Possibly the problem is in MingW or cygwin or whatever is used to make the windows builds. The configure script uses AC_SYS_LARGEFILE, which should pull define _FILE_OFFSET_BITS=64. If the windows build environment doesn't support this, it should be fixed.