Merge pull request #19605 from ChayimFriedman2/fix-sig

minor: Fix signature of libc memory usage function on Linux
This commit is contained in:
Chayim Refael Friedman 2025-04-16 14:08:37 +00:00 committed by GitHub
commit 0a8f808ebc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -78,7 +78,8 @@ fn memusage_linux() -> MemoryUsage {
let alloc = unsafe { libc::mallinfo() }.uordblks as isize;
MemoryUsage { allocated: Bytes(alloc) }
} else {
let mallinfo2: fn() -> libc::mallinfo2 = unsafe { std::mem::transmute(mallinfo2) };
let mallinfo2: extern "C" fn() -> libc::mallinfo2 =
unsafe { std::mem::transmute(mallinfo2) };
let alloc = mallinfo2().uordblks as isize;
MemoryUsage { allocated: Bytes(alloc) }
}