File tree Expand file tree Collapse file tree 1 file changed +1
-3
lines changed Expand file tree Collapse file tree 1 file changed +1
-3
lines changed Original file line number Diff line number Diff line change @@ -62,15 +62,13 @@ fn memusage_linux() -> MemoryUsage {
62
62
// mallinfo2 is very recent, so its presence needs to be detected at runtime.
63
63
// Both are abysmally slow.
64
64
65
- use std:: ffi:: CStr ;
66
65
use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
67
66
68
67
static MALLINFO2 : AtomicUsize = AtomicUsize :: new ( 1 ) ;
69
68
70
69
let mut mallinfo2 = MALLINFO2 . load ( Ordering :: Relaxed ) ;
71
70
if mallinfo2 == 1 {
72
- let cstr = CStr :: from_bytes_with_nul ( b"mallinfo2\0 " ) . unwrap ( ) ;
73
- mallinfo2 = unsafe { libc:: dlsym ( libc:: RTLD_DEFAULT , cstr. as_ptr ( ) ) } as usize ;
71
+ mallinfo2 = unsafe { libc:: dlsym ( libc:: RTLD_DEFAULT , c"mallinfo2" . as_ptr ( ) ) } as usize ;
74
72
// NB: races don't matter here, since they'll always store the same value
75
73
MALLINFO2 . store ( mallinfo2, Ordering :: Relaxed ) ;
76
74
}
You can’t perform that action at this time.
0 commit comments