Skip to content
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

Is there a way to obtain the address of shared memory at init phase ? #514

Closed
lix19937 opened this issue Sep 24, 2024 · 2 comments
Closed

Comments

@lix19937
Copy link

lix19937 commented Sep 24, 2024

The loan API allows for true zero-copy transfer by directly consctructing the message data in Shared Memory. To do so, we first have to loan this Shared Memory chunk explicitly.

// init phase 
std::set<void *> ptr_set;



// in callback phase at runtime  
auto loaned_msg = pub_->borrow_loaned_message();
loaned_msg.get().data = count_++;
pub_->publish(std::move(loaned_msg));
ptr_set.insert(&(loaned_msg.get().data));

I found ptr_set.size() = N // N is a const number

@fujitatomoya
Copy link
Contributor

@lix19937 can you close this issue? this is more like a question, please consider to post this kind of question to https://robotics.stackexchange.com/ where is the centralized QA site. it is likely that you can get the feedback against the questions from community.

@lix19937
Copy link
Author

lix19937 commented Oct 4, 2024

OK, thanks @fujitatomoya

@lix19937 lix19937 closed this as completed Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants