actix / actix/actix-web

Memory Leak

未关闭
#3,198 57 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Rust
星标
24.8k
派生
1.9k
平均合并
23 小时 10 分钟
30 天内合并 PR
26

描述

Memory Leak / Memory "not recycled" in Actix 3.3 #1943

The program is active_ On the web, my program has a startup memory of 14MB and requests the interface to perform some operations with a memory of 800MB+. However, the 800MB+in subsequent programs has not been released. What is the reason for this? Some of the language's setting features, or are there any useful tools such as PPROF that can detect memory overflow
![image](https://github.com/actix/actix-web/assets/43371021/542d9ee7-a729-44be-9a22-12576465b904)
![image](https://github.com/actix/actix-web/assets/43371021/b1c243bf-c80c-4381-85db-fe7b85101a38)

Actix_ When web requests return big data, the memory is not released and will continue to be occupied. Is the original intention of this issue and will it be improved in the future

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 = HashMap::with_capacity(100000);
test(&mut h).await;

HttpResponse::InternalServerError().body(format!("{:?}", h))
}

async fn test (h : &mut HashMap){

// tokio::time::sleep(tokio::time::Duration::from_secs(25)).await;
println!("start");
for v in 0..1000000{
h.insert(v,v);
}
}

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。