Comments (6)
No, that's not the case. The padding is just the remaining bytes in the chunk but the payload is not increased to match a multiple of the alignment and it is also not enforced. If you have the requirement to get memory which is a multiple of the alignment you need to request it via the payload size. If you don't do it, the best case scenario would be that by accident the padding is large enough to fit the remaining bytes into the chunk. The not so good but as long as you don't write to the memory also not bad scenario would be to read data from the next chunk. The worst case scenario would be to get the last chunk of the last mempool and try to access memory which is not mapped to the address space which would result in a segfault.
from iceoryx.
Got it. My misunderstanding then. Looks like I need to solve my problem via proper allocation of the chunk.
Thanks!
from iceoryx.
What would be the benefit of having padding included? The padding bytes won't be initialized so accessing them is UB. What would be the use case of knowing this value?
from iceoryx.
So we can for example perform direct writes: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/global_file_system/s1-manage-direct-io
We don't care about the data in the padding but the point of custom alignments is to be able to work with the data in sizes that are a multiple of that alignment. So we need to be able to access that "size-with-alignment-padding".
from iceoryx.
Maybe I misunderstand something but doesn't that just require the payload itself to be a multiple of the alignment?
Note, there are no guarantees regarding the padding. I can be 0 or 1GB. It is not even guaranteed to be the same on subsequent calls to loan
. If you have this requirement, then you need to request a payload size which is a multiple of the alignment.
from iceoryx.
The payload needs to be aligned, but does not need to have a size itself which is a multiple of the alignment. We do however need to provide a size to the API that is a multiple of the alignment, even if the size of the payload itself is smaller.
My understanding from chunk_header.md is that padding will be applied after the user payload to fulfill the alignment requirements. For example, if you have an alignment of 4096 and your user payload is 8000 bytes, then 192 bytes of padding will be added to make the total size with padding 8192 = 4096*2. This is the size I need exposed.
Right now I am recalculating the size by doing pointer arithmetic on the payload header compared to the chunk header, and then subtracting that from the chunk size. I've even added an IOX_ENSURES
to verify that the calculated size is indeed a multiple of the alignment.
This is a whole lot of wasted arithmetic on every publisher loan. I'd rather just access the value directly as it has already been more or less calculated when creating the chunk header.
from iceoryx.
Related Issues (20)
- POPO__CHUNK_LOCKING_ERROR on iox-roudi HOT 3
- Remove warning in toml gateway config parser
- how to run ice_access_control demo HOT 8
- Iceoryx RAW_SOCKET buffer usage HOT 7
- Update links to default branch
- Make iceoryx resource prefix a compile time option
- Fix new clang-tidy-18 warnings
- ICEORYX error! POPO__CHUNK_LOCKING_ERROR HOT 4
- Mark iox container operations which return bool as [[nodiscard]] HOT 1
- 'iox::string' tests can exceed the translation unit compilation timeout
- Prepare v2.0.6 release for ROS2
- Compiler warnings on latest macOS on release_2.0
- sendChunk, releaseChunk latencies HOT 8
- While setting the acquired shared memory to zero a fatal SIGBUS signal appeared caused by memset. HOT 5
- how to support string using zero-copy transport HOT 1
- Add 'iox' prefix to all functions and types in the platform abstraction
- SingleProcess example crashes on QNX HOT 4
- : backtrace: HOT 2
- Is `libatomic` still required to build Iceoryx? HOT 7
- Some questions about IndexQueue. HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iceoryx.