• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: shmget from a Cocoa application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: shmget from a Cocoa application


  • Subject: Re: shmget from a Cocoa application
  • From: Alastair Houghton <email@hidden>
  • Date: Fri, 13 Jul 2007 09:12:36 +0100

On 13 Jul 2007, at 08:13, Jay Reynolds Freeman wrote:

I have a call to shmget embedded within a substantial
Cocoa application, which looks more or less like this:

  smid_foo = shmget( 42, memory_wanted, IPC_CREAT | 0600 );

This is the first and only call to shmget, so the shared
memory should not yet exist.  The app  builds with no
errors or warnings.

When memory_wanted is a little greater than 10 MByte, the
call fails, and perror( 0 ) prints "Invalid argument".

This is the wrong list for this query; the problem is nothing to do with Cocoa. You probably want the Darwin list.


Anyway, the answer to your question is that there is a limit on the total amount of memory supplied by shmget() in the system, which is probably why your app can't allocate memory. You probably, therefore, don't want to use it.

Take a look at the POSIX function shm_open() instead; you use it with mmap() (shm_open() just gives you a file descriptor; typically you ftruncate() it to the required length, then mmap() the descriptor to get it into your address space).

Kind regards,

Alastair.

--
http://alastairs-place.net




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Discovering USB devices (From: Pierre Bernard <email@hidden>)
 >Re: Discovering USB devices (From: Kevin Elliott <email@hidden>)
 >Re: Discovering USB devices (From: Pierre Bernard <email@hidden>)
 >Re: Discovering USB devices (From: Kevin Elliott <email@hidden>)
 >shmget from a Cocoa application (From: Jay Reynolds Freeman <email@hidden>)

  • Prev by Date: shmget from a Cocoa application
  • Next by Date: Re: Quick question: easy way to draw bitmap?
  • Previous by thread: shmget from a Cocoa application
  • Next by thread: Re: Discovering USB devices
  • Index(es):
    • Date
    • Thread