小编div*_*tes的帖子

我怎样才能延迟Rust的内存自动管理?

Rust开发了一个聪明的内存管理系统,但我有以下情况:

loop {
    let mut example = Very_Complicated_Struct::new();
    // very complicated data structure created

    dealing_with(&mut example);
}
// End of scope, so Rust is supposed to automatically drop the
// memory of example here, which is time consuming

time_demanding_steps();

// But I want Rust to drop memory here,
// after the time_demanding_steps()
Run Code Online (Sandbox Code Playgroud)

Rust有办法这么做吗?

memory-management rust

1
推荐指数
1
解决办法
107
查看次数

标签 统计

memory-management ×1

rust ×1