I’m posting this on a blog entry, not because I think my loyal blog readers are going to be interested by it, but someone out there on the web might run into this issue, and some googling suggests that nobody has reported on it.

There were two strange software failures going on recently, both of them quite troublesome, and it took until today to realize they were directly related.

On the one hand, I noticed that three people (who now work distantly together) were having problems with iChat on their G5 computers. Basically, an attempt to initiate a video chat would die with a cryptic—and misleading—message: Disconnected from Video Chat because: Can’t get video from the camera. The problem could only be solved by rebooting the computer.

There was another strange and inconsistent problem that just started happening, where Dave and I would not be able to start up Postgres due to a memory error: FATAL: could not create shared memory segment: Cannot allocate memory

The Postgres problem would occasionally pop up, and after the error showed up, there would be nothing short of rebooting that would alleviate the problem.

Well, the two problems appear to be related. If you have an iChat video chat, you will be able to run Postgres; and if you run the Postgres database, you will be unable to run iChat. The problem seems to lie with something called shared memory which is a section of memory that the Operating System manages that is able to be accessed by multiple processes.

Operating Systems generally have settings where you can specify the maximum amount of shared memory used, the maximum size of a shared memory segment, etc. In OS X these settings are the in file /etc/rc. Dave seems to have been able to fix the problem by increasing this maximum shared memory to 128 megabytes. (The default is 4!) I’m guessing you can have much less, but we haven’t had the chance to do much testing yet.

One good resource is this page which has a comment on the very bottom by a Mac guy who makes specific recommendations for OS X. (Note, it’s dated 2002, so it’s a little stale.)

If you have any luck or feedback, please provide it in the comments below so others can benefit from your wisdom!