Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. SharedMemory: How fast is attach and detach?

SharedMemory: How fast is attach and detach?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 3 Posters 808 Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    stvokr
    wrote on last edited by
    #1

    Hi all,

    Consider the following situation:
    I have a program A which creates a shared memory, and a program B which attaches the shared memory.
    Now, when program A is closed, program B is still attached to the shared memory. When program A is restartet, it cannot create the shared memory because B is still attached.
    To avoid this problem, program B could attach and detach the shared memory every time it wants to read data.
    And here is my question: How fast is attaching and detaching the shared memory, because reading out some data in my program should happen 100 times per second and faster.

    regards
    Oliver

    Chris KawaC 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You should benchmark. That will depend on several factors so you should test the speed yourself.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • S stvokr

        Hi all,

        Consider the following situation:
        I have a program A which creates a shared memory, and a program B which attaches the shared memory.
        Now, when program A is closed, program B is still attached to the shared memory. When program A is restartet, it cannot create the shared memory because B is still attached.
        To avoid this problem, program B could attach and detach the shared memory every time it wants to read data.
        And here is my question: How fast is attaching and detaching the shared memory, because reading out some data in my program should happen 100 times per second and faster.

        regards
        Oliver

        Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @stvokr said in SharedMemory: How fast is attach and detach?:

        To avoid this problem, program B could attach and detach the shared memory every time it wants to read data.

        Or program A could first check if the shared memory segment exists (by trying to attach to it) and only if that fails with QSharedMemory::NotFound error it would create it.

        1 Reply Last reply
        3

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved