Coder Social home page Coder Social logo

Comments (3)

elfenpiff avatar elfenpiff commented on June 5, 2024 1

@afpgit This is expected. The types you are allowed to use in zero-copy communication must satisfy multiple properties:

  1. Self Contained, they are not allowed to use the heap
  2. They shall not use vtables
  3. They are not allowed to use pointers in their internal structure

The string violates 1. and 3. But no worries, you can use the iox::stringas alternative, then your code would look like:

#include "iox/string.hpp"

struct RadarObjectWithString {
  double x = 0.0;
  double y = 0.0;
  double z = 0.0;
  iox::string<128> s("string"); // creates a fixed size string with the maximum capacity of 128
};

The reason why you have to satisfy strictly the requirements is, that every process has its own local process space that cannot be accessed from within another process. So if your data structure uses the heap, this heap address is not accessible from another process which causes a segfault.
If you use vtables those tables are essentially function pointer that are also no longer valid in another process space.
And if your construct is using pointers internally, those pointers are invalidated in another process space due to the address randomization. For instance in process A the process space goes from 0x10 ... 0x2020 and in process B from 0xbebe ... 0xcafe
so if the pointer in process A is pointing to memory location 0x12 it is valid only for process A, in process B it would point to an invalid memory address.

from iceoryx.

mossmaurice avatar mossmaurice commented on June 5, 2024

@afpgit You can find the above info and much more also in the official documentation: https://iceoryx.io/latest/getting-started/overview/#restrictions. A good read is about shared memory which visualizes what @elfenpiff described can be found here: https://github.com/eclipse-iceoryx/iceoryx/blob/v2.0.5/doc/shared-memory-communication.md

from iceoryx.

elBoberido avatar elBoberido commented on June 5, 2024

Closing the issue. elfenpiff and mossmaurice already answered the question.

from iceoryx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.