Skip to content

Commit

Permalink
[#532] Add safety docs
Browse files Browse the repository at this point in the history
  • Loading branch information
elfenpiff committed Dec 4, 2024
1 parent 57af933 commit 3b0e930
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions iceoryx2-bb/memory/src/pool_allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ impl PoolAllocator {
self.bucket_alignment
}

/// Releases an previously allocated bucket of memory.
///
/// # Safety
///
/// * `ptr` must be allocated previously with [`PoolAllocator::allocate()`] or
/// [`PoolAllocator::allocate_zeroed()`]
///
pub unsafe fn deallocate_bucket(&self, ptr: NonNull<u8>) {
self.verify_init("deallocate");

Expand Down
2 changes: 2 additions & 0 deletions iceoryx2-cal/tests/zero_copy_connection_trait_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ mod zero_copy_connection {
use iceoryx2_bb_posix::barrier::*;
use iceoryx2_bb_system_types::file_name::FileName;
use iceoryx2_bb_testing::assert_that;
use iceoryx2_bb_testing::watchdog::Watchdog;
use iceoryx2_cal::named_concept::*;
use iceoryx2_cal::named_concept::{NamedConceptBuilder, NamedConceptMgmt};
use iceoryx2_cal::shm_allocator::{PointerOffset, SegmentId};
Expand Down Expand Up @@ -530,6 +531,7 @@ mod zero_copy_connection {

#[test]
fn blocking_send_blocks<Sut: ZeroCopyConnection>() {
let watchdog = Watchdog::new();
let name = generate_name();
let config = Mutex::new(generate_isolated_config::<Sut>());

Expand Down

0 comments on commit 3b0e930

Please sign in to comment.