Skip to content

The memory is not returned to the operating system immediately #330

@cjon123

Description

@cjon123

(Mariadb 10.4.30) The memory is not returned to the operating system immediately, but is returned after a period of inactivity. How can I solve this problem? This is true even when using drop and disconnect. The code is as follows:

[dependencies]
tokio = {version="1.25.0",features = ["full"]}
mysql_async = { version = "0.35.1",default-feature=false,features=["minimal","native-tls-tls"] }

`pub async fn get_chat_log_img(mid:&String)->Result<Vec,anyhow::Error>{

let pool = mysql_async::Pool::new("mysql://root:[email protected]:3306/jyp?stmt_cache_size=0");
let mut conn = pool.get_conn().await?;
let stmt = conn.prep("SELECT `MIMG` FROM chat_message WHERE ID=:mid;").await?;
let rr:Option<Vec<u8>> = conn.exec_first(&stmt, params!{"mid"=>mid}).await?;
let rr = match rr {
    Some(v)=>v,
    None=>{
        return Ok(Vec::<u8>::new());
    }
};
let _ = conn.reset();
conn.close(stmt).await?;
drop(conn);
pool.disconnect().await?;
Ok(rr)

}
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions