-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adjust Shared-memory pool's size #568
Comments
In iceoryx2 it's not necessary anymore. Each publisher has it's own mempool and the number of memory chunks are inferred from the confiuration of the service. |
Thanks for your reply. I also want to ask: there are three method to write data in a shared-memory,
Is there a C++ API similar to iceoryx1 where I can manually loan shared memory of a desired size and release it through explicit user calls? In iceoryx1 I use
am confused about the lifecycle of shared memory |
For this use-case, the Take a look at this example: https://github.com/eclipse-iceoryx/iceoryx2/blob/main/examples/cxx/publish_subscribe_dynamic_data/src/publisher.cpp#L55 Note that you can also access a pointer to the shared memory via something like:
You can then do a placement new, or populate the bytes via any other mechanism, but you have the ensure not to exceed the loaned size yourself, so it is safer to use one of the provided methods that you listed.
The sample is released when it goes out of scope through RAII mechanisms. You can also manually destruct the sample to achieve this. |
I have a question about DDS sample lifecycle management. In a distributed scenario where Process A publishes data and Process B subscribes to it, if the sample is released when it goes out of scope in the publisher's function, will this affect the subscriber's ability to receive the data? |
@owny990312 The subscriber can consume the sample if it holds the
Just let the sample go out of scope. |
Adjust Shared-memory pool's size like iceoryx1, we have a .toml file to set the shm-pool's size. Or iceoryx2 can auto-adjust it
The text was updated successfully, but these errors were encountered: