mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-30 00:34:26 +01:00
Relax memory ordering of operations within the test CountingAlloc
This commit is contained in:
parent
8d0ace2d64
commit
8284bd760f
@ -1395,14 +1395,14 @@ mod test {
|
|||||||
}
|
}
|
||||||
unsafe impl GlobalAlloc for CountingAlloc {
|
unsafe impl GlobalAlloc for CountingAlloc {
|
||||||
unsafe fn alloc(&self, layout: std::alloc::Layout) -> *mut u8 {
|
unsafe fn alloc(&self, layout: std::alloc::Layout) -> *mut u8 {
|
||||||
self.allocated.fetch_add(layout.size() as i64, atomic::Ordering::SeqCst);
|
self.allocated.fetch_add(layout.size() as i64, atomic::Ordering::Relaxed);
|
||||||
self.resident.fetch_add(layout.size() as i64, atomic::Ordering::SeqCst);
|
self.resident.fetch_add(layout.size() as i64, atomic::Ordering::Relaxed);
|
||||||
|
|
||||||
System.alloc(layout)
|
System.alloc(layout)
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn dealloc(&self, ptr: *mut u8, layout: std::alloc::Layout) {
|
unsafe fn dealloc(&self, ptr: *mut u8, layout: std::alloc::Layout) {
|
||||||
self.resident.fetch_sub(layout.size() as i64, atomic::Ordering::SeqCst);
|
self.resident.fetch_sub(layout.size() as i64, atomic::Ordering::Relaxed);
|
||||||
System.dealloc(ptr, layout)
|
System.dealloc(ptr, layout)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user