程序是actix_web的,我的程序启动的时候14MB的内存,请求接口会用800MB+的内存执行一些操作。然而,后续接口返回大量数据后程序中的800MB+尚未回收。这是什么原因?该语言的一些设置功能,或者有没有像PPROF这样的有用工具可以检测内存溢出 然后发现 大多web框架都有这个问题   ``` use actix_web::{get, HttpResponse, Responder}; use crate::controller::link_inspection::check::LinkInspection; use std::collections::HashMap; #[get("/check")] async fn check() -> impl Responder { // 启动堆分析器 // let res = LinkInspection::new().doing().await; // match res { // Ok(response) => HttpResponse::Ok().json(response), // Err(error) => HttpResponse::InternalServerError().body(error.to_string()), // } let mut h: HashMap<i64,i64> = HashMap::with_capacity(100000); test(&mut h).await; HttpResponse::InternalServerError().body(format!("{:?}", h)) } async fn test (h : &mut HashMap<i64,i64>){ // tokio::time::sleep(tokio::time::Duration::from_secs(25)).await; println!("start"); for v in 0..1000000{ h.insert(v,v); } } ```
Activity
zqlpaopao commentedon Nov 23, 2023
具体案例 查看 actix/actix-web#3198