[Qt-interest] Shared Memory - How to Increase System Size Past System-Imposed Size Restrictions

Thiago Macieira thiago at kde.org
Mon Feb 15 10:53:57 CET 2010


Em Segunda-feira 15 Fevereiro 2010, às 10:28:57, Ragu Vijaykumar escreveu:
> Hi!
> 
> I have a program in which I am trying to write a lot of data to shared
> memory using QSharedMemory. The program works when I am writing less than
> 4 MB of data to the Shared Memory, but after the data exceeds 4MB, I get
> an error (InvalidSize) with the error string reading
> "QSharedMemory::handle: system-imposed size restrictions". How can I
> increase the size of the Shared Memory buffer on my system?
> 
> I'd like to write up to 500MB of data to the shared memory buffer. I have
> over 12 GB of RAM on my system with plenty free (>>8GB) at runtime.

Use multiple shared memory segments.

Sorry, that's a limitation of the System V SHM interface:

       EINVAL A new segment was to be created and size < SHMMIN or size > SHM‐
              MAX,  or  no new segment was to be created, a segment with given
              key existed, but size is greater than the size of that segment.

On Linux:
/usr/include/linux/shm.h:#define SHMMAX 0x2000000                /* max shared 
seg size (bytes) */


-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100215/a5ea17f9/attachment.bin 


More information about the Qt-interest-old mailing list