actix / actix/actix-web

Memory Leak

Offen
#3,198 57 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
24.8k
Forks
1.9k
Ø Merge
23 Std. 10 Min.
Gemergte PRs (30 T.)
26

Beschreibung

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);
}
}

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.