You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: malloc_trim_loop.rs
    path of file: ./repos/cube/rust/cubestore/cubestore/src/util
    
    the code of the file until where you have to start completion: use crate::sys::malloc::{trim_allocs, HAS_TRIM_ALLOC};
use std::time::Durat
    
pub fn spawn_malloc_trim_loop(period: Duration) {
    if !HAS_TRIM_ALLOC {
        return;
    }

    // We detach the thread, so have to be prepared it gets killed at any point.
    std::thread::spawn(move || loop {
        std::thread::sleep(period);
        trim_allocs()
    });
}