File tree 1 file changed +10
-2
lines changed
src/cpp/rtps/transport/shared_mem
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -301,8 +301,16 @@ bool SharedMemTransport::init(
301
301
{
302
302
return false ;
303
303
}
304
- shared_mem_segment_ = shared_mem_manager_->create_segment (configuration_.segment_size (),
305
- configuration_.port_queue_capacity ());
304
+ uint32_t max_allocations = configuration_.segment_size () / configuration_.max_message_size ();
305
+ if ((configuration_.segment_size () % configuration_.max_message_size ()) != 0 )
306
+ {
307
+ ++max_allocations;
308
+ }
309
+ if (configuration_.port_queue_capacity () > max_allocations)
310
+ {
311
+ max_allocations = configuration_.port_queue_capacity ();
312
+ }
313
+ shared_mem_segment_ = shared_mem_manager_->create_segment (configuration_.segment_size (), max_allocations);
306
314
307
315
// Memset the whole segment to zero in order to force physical map of the buffer
308
316
auto buffer = shared_mem_segment_->alloc_buffer (configuration_.segment_size (),
You can’t perform that action at this time.
0 commit comments