@@ -209,47 +209,16 @@ rmw_ret_t PublisherData::publish(
209
209
210
210
// To store serialized message byte array.
211
211
char * msg_bytes = nullptr ;
212
- std::optional<z_owned_shm_mut_t > shmbuf = std::nullopt;
213
- auto always_free_shmbuf = rcpputils::make_scope_exit (
214
- [&shmbuf]() {
215
- if (shmbuf.has_value ()) {
216
- z_drop (z_move (shmbuf.value ()));
217
- }
218
- });
219
212
220
213
rcutils_allocator_t * allocator = &rmw_node_->context ->options .allocator ;
221
214
222
215
auto always_free_msg_bytes = rcpputils::make_scope_exit (
223
- [&msg_bytes, allocator, &shmbuf ]() {
224
- if (msg_bytes && !shmbuf. has_value () ) {
216
+ [&msg_bytes, allocator]() {
217
+ if (msg_bytes) {
225
218
allocator->deallocate (msg_bytes, allocator->state );
226
219
}
227
220
});
228
221
229
- // TODO(anyone): Move this zenoh_cpp API
230
- // Get memory from SHM buffer if available.
231
- // if (shm_provider.has_value()) {
232
- // RMW_ZENOH_LOG_DEBUG_NAMED("rmw_zenoh_cpp", "SHM is enabled.");
233
-
234
- // auto provider = shm_provider.value()._0;
235
- // z_buf_layout_alloc_result_t alloc;
236
- // // TODO(yuyuan): SHM, configure this
237
- // z_alloc_alignment_t alignment = {5};
238
- // z_shm_provider_alloc_gc_defrag_blocking(
239
- // &alloc,
240
- // z_loan(provider),
241
- // SHM_BUF_OK_SIZE,
242
- // alignment);
243
-
244
- // if (alloc.status == ZC_BUF_LAYOUT_ALLOC_STATUS_OK) {
245
- // shmbuf = std::make_optional(alloc.buf);
246
- // msg_bytes = reinterpret_cast<char *>(z_shm_mut_data_mut(z_loan_mut(alloc.buf)));
247
- // } else {
248
- // // TODO(Yadunund): Should we revert to regular allocation and not return an error?
249
- // RMW_SET_ERROR_MSG("Failed to allocate a SHM buffer, even after GCing.");
250
- // return RMW_RET_ERROR;
251
- // }
252
- // } else {
253
222
// Get memory from the allocator.
254
223
msg_bytes = static_cast <char *>(allocator->allocate (max_data_length, allocator->state ));
255
224
RMW_CHECK_FOR_NULL_WITH_MSG (
0 commit comments