After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 102058 - shared memory doesn't work on Darwin
shared memory doesn't work on Darwin
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: General
1.x
Other Mac OS
: Normal normal
: 2.0
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2002-12-27 17:35 UTC by Jakub Steiner
Modified: 2004-01-08 14:42 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jakub Steiner 2002-12-27 17:35:17 UTC
GIMP fails to load everything apart xcfs, most filters misrender too (I get
a black screen most of the time). If run with --no-shm, everything works. I
get a lot of these errors on the console too, don't know if it's related:

*** malloc[24479]: Deallocation of a pointer not malloced: 0xf265; This
could be a 
double free(), or free() called with the middle of an allocated block; Try
setting 
environment variable MallocHelp to see tools to help debug
Comment 1 douglasnorton 2003-01-12 15:52:12 UTC
I too have the same problem with Gimp and OSX.
Comment 2 Simon Budig 2003-01-12 15:59:25 UTC
Apparently this also happens with Gimp 1.2.3. We should try to fix
this for 1.2.4 IMHO.
Comment 3 Raphaël Quinet 2003-01-13 09:51:17 UTC
Setting the target milestone to 1.2.4, as per Simon's suggestion.
Some contributions from MacOS users and developers would be more than
welcome...
Comment 4 Sven Neumann 2003-01-13 10:17:44 UTC
How can we fix this if we have no idea what is going wrong? We can
only fix it if we get some debugging help here and even if we find a
fix, we should be very careful to apply it to the 1.2 tree. This
should only happen if the fix is trivial and fixing this problem is
definitely not a requirement for the 1.2.4 release. Setting the target
milestone to 1.3.x for that reason.
Comment 5 Ben Hines 2003-01-13 16:03:16 UTC
I don't think your shm will ever work well on OS X. I assume you are using sys v shared memory - OS X by default has a very small sysv shared memory allocation, which you are likely to hit quickly. <looks at the source> It looks like you are using SysV shm with shmat(). I think POSIX shm works better on OS X, and definitely mmap works fine. POSIX shm is more standard than sysv shm anyway, so you should probably switch.

btw, you can increase your sysv shm allocations on OS X by editing the sysctls in the file: /System/Library/StartupItems/SystemTuning/SystemTuning. But this would only be acceptable for testing purposes, its not a fix for gimp. :)

in summary, GIMP should use POSIX shm on OS X, or mmap.

-Ben (fink developer)
Comment 6 Ben Hines 2003-01-13 16:04:16 UTC
argh, stupid safari didn't put in line breaks, Sorry about that, blame Apple. :)
Comment 7 Manish Singh 2003-01-13 23:40:27 UTC
POSIX shm is far from universal. Linux only has it with glibc 2.2 or
greater, and kernel 2.4. It's part of POSIX.1b, which is something a
lot of older unixes don't implement.

Ideally, we should move towards a full mmap based solution, but that
is post-1.4 material. It doesn't look that difficult to put a POSIX
shm implementation in the current code, so that could be done in HEAD.
It should be a configure option (--enable-posix-shm) that isn't on by
default, except perhaps on OS X.

I wonder what the rationale Apple had for putting this limitation on
SysV shm.
Comment 8 Simon Budig 2003-01-13 23:51:41 UTC
Ok, maybe we should just add a hack into the configure script for
1.2.4 to disable shared memory on OS X. So unsuspecting users would
not get trapped by this limitation by Apple.
Comment 9 Manish Singh 2003-01-13 23:58:54 UTC
Well, I wouldn't be opposed to backporting the changes to HEAD to 1.2
once they are done. They'd only affect OS X users and if it didn't
work properly, well, they were doing --no-shm anyway.

We'd want the configure script special casing in either case, so may
as well do what Simon suggested now. I don't consider this working shm
a blocker for 1.2.4.
Comment 10 Sven Neumann 2003-01-14 10:03:48 UTC
This has been addressed in 1.2 and HEAD:

2003-01-13  Manish Singh  <yosh@gimp.org>

  * configure.in: Partially address #102058 with a --with-shm configure
  options. Defaults to sysv except on OS X, where it is none.
Comment 11 Manish Singh 2003-01-17 21:16:11 UTC
Hm, I heard that OS X 10.2 doesn't have this issue anymore. Can anyone
confirm or deny this?
Comment 12 Jakub Steiner 2003-01-17 21:24:17 UTC
I'm using 10.2.3 and still get this.
Comment 13 Manish Singh 2003-01-17 21:49:37 UTC
I guess the OS X server dist has it tuned up, otherwise Oracle won't
run. I wonder if you can query the allocation size somehow...
Comment 14 gparker-gnome 2003-01-19 01:59:22 UTC
SysV shm is available in Mac OS X 10.1, but is severely limited; the hardcoded systemwide shared region count and max total shared memory are too small to be useful. On Mac OS X 10.2, the SysV shm limits are sysctl parameters, so it's possible to increase them to useful levels. 

kern.sysv.shmmax: 4194304
kern.sysv.shmmin: 1
kern.sysv.shmmni: 32
kern.sysv.shmseg: 8
kern.sysv.shmall: 1024
Comment 15 Manish Singh 2003-07-30 17:31:30 UTC
Downgrading severity, 1.2.x and 1.3.x both default to shm off on MacOS X.

If someone wants to implement a transport over mmap or POSIX shm feel
free.
Comment 16 Sven Neumann 2003-11-25 18:06:42 UTC
I am afraid this won't necessarily happen before 2.0. We could target
it for 2.0.1 or decide to postpone it to 2.2. Or is someone working on
this?
Comment 17 Manish Singh 2003-12-27 08:12:41 UTC
Well this was rather trivial, I'm surprised no OS X person stepped up
to the task.

2003-12-27  Manish Singh  <yosh@gimp.org>
                                                                     
          
        * app/main.c
        * app/plug-in/plug-in-shm.c
        * libgimp/gimp.c: POSIX shared memory tile transport
implementation,
        and a little code cleanup of the SysV and Win32 implementations.
                                                                     
          
        * configure.in: checks for shm_open, default to POSIX shared
memory
        transport on OS X.
Comment 18 Manish Singh 2003-12-27 08:14:10 UTC
I'd like an OS X user to confirm this works before closing the bug.
Comment 19 Sven Neumann 2003-12-27 15:05:32 UTC
I plan to build this on Mac OS 10.3 today.
Comment 20 Daniel Rogers 2003-12-30 23:37:54 UTC
Sven: did it work?
Comment 21 Sven Neumann 2003-12-30 23:49:04 UTC
Sorry, but I didn't get around to build it. People that promised me an
account didn't show up until the event was almost over so it just
didn't happen :(
Comment 22 Mat Caughron 2004-01-08 12:29:09 UTC
The issue is apparently resolved with the build I did this morning of
GIMP 2.0pre1 on Mac OS X 10.3.