Skip to content

[#436] Document payload type restrictions #444

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions FAQ.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Frequently Asked Questions

## Encountered a SEGFAULT. What Kind Of Data Types Can Be Transmitted Via iceoryx2

iceoryx2 stores all data in shared memory, which imposes certain restrictions.
Only data that is self-contained and does not use pointers to reference itself
is allowed. This is because shared memory is mapped at different offsets in
each process, rendering absolute pointers invalid. Additionally, if the data
structure uses the heap, it is stored locally within a process and cannot be
accessed by other processes. As a result, data types such as `String`, `Vec`,
or `HashMap` cannot be used as payload types.

To address this, iceoryx2 provides shared-memory-compatible data types. You
can refer to the [complex data types example](examples/rust/complex_data_types),
which demonstrates the use of `FixedSizeByteString` and `FixedSizeVec`.

## How To Send Data Where The Size Is Unknown At Compilation-Time?

Take a look at the
Expand Down
28 changes: 26 additions & 2 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Examples

> [!IMPORTANT] The examples are not yet functional in all languages. Check the
> list below to see what is already working!
> [!IMPORTANT]
> The examples are not yet functional in all languages. Check the list below to see
> what is already working!

## Foundations of Communication in iceoryx2 Applications

Expand Down Expand Up @@ -40,6 +41,29 @@ intend. The service port factory allows you to fine-tune the settings and
behavior of individual ports, giving you precise control over how they interact
and exchange data.

## Payload Type Restrictions

> [!CAUTION]
> iceoryx2 stores payload data in shared memory, which imposes the restriction that
> the payload type must be self-contained and cannot use heap memory. Additionally,
> internal pointers are not allowed because the shared memory is mapped at different
> offsets in each process, making absolute pointers invalid and potentially leading
> to segmentation faults.

To address these limitations, we provide data types that are compatible with shared
memory. For Rust, we offer:

* `FixedSizeByteString`
* `FixedSizeVec`

For C++, we provide:

* `iox::vector`
* `iox::string`
* `iox::list`

These types are demonstrated in the complex data types example.

## Overview

| Name | Language | Description |
Expand Down
Loading