Skip to content

Commit 0cca429

Browse files
committed
fix: support_core_test uses real allocations for FreeBlock commands
The support core now actually calls libc::free on FreeBlock payloads, so the test needs to send real malloc'd pointers instead of fake ones.
1 parent d92f5b6 commit 0cca429

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

aethalloc-amo/tests/support_core_test.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Integration test for ring buffer + support core
22
//!
3-
//! Tests the full AMO pipeline with concurrent producer/consumer.
3+
//! Tests the full AMO pipelines with concurrent producer/consumer.
44
55
#![cfg(feature = "std")]
66

@@ -42,9 +42,11 @@ fn test_producer_consumer_threads() {
4242

4343
let producer = thread::spawn(move || {
4444
for i in 0..100 {
45+
// Allocate real memory so support_core can free it safely
46+
let ptr = unsafe { libc::malloc(16) as *mut u8 };
4547
let payload = FreeBlockPayload {
46-
ptr: i as *mut u8,
47-
size: i * 16,
48+
ptr,
49+
size: 16,
4850
size_class: (i % 16) as u8,
4951
};
5052
let entry = RingEntry::new(
@@ -60,7 +62,7 @@ fn test_producer_consumer_threads() {
6062
});
6163

6264
producer.join().unwrap();
63-
thread::sleep(Duration::from_millis(50));
65+
thread::sleep(Duration::from_millis(100));
6466

6567
running.store(false, std::sync::atomic::Ordering::Relaxed);
6668
consumer.join().unwrap();

0 commit comments

Comments
 (0)