Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[BUG] Memory accumulation when using load_image in a loop

未关闭
#365 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
30/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
rust

调研方向

首先运行 src/main.rs:6 中提供的循环,并检查 src/image/mod.rs:317 中的 load_image wrapper,以及报告的原生 af_load_image 路径。跟踪重复加载图像是否会保留设备内存,并确定相关的清理或所有权行为。完成的标准是:复现过程不再持续累积内存直至出现内存不足错误,并且有一个针对重复加载的回归测试。

由索引模型根据 Issue 内容生成。

描述

Bug

The following program crashed. But why?

use arrayfire::*;

fn main() {
    let mut y =constant!(0 as u8;1);
    for i in 0..1000 {
        let x = load_image::<u8>("2dzs/robot_2dz.png".to_string(), true);
        let z = or(&x, &y, true);
        y = z.copy();
        println!("i={}", i);
    }
    println!("max(y)={:#?}", max_all(&y));
}

i=0
i=1
i=2
i=3
i=4
i=5
i=6
i=7
i=8
i=9
i=10
i=11
i=12
i=13
i=14
i=15
i=16
i=17
i=18
i=19
i=20
i=21
i=22
i=23
i=24
i=25
i=26
i=27
i=28
i=29
i=30
i=31
i=32
i=33
i=34
i=35
i=36
i=37
i=38
i=39
i=40
i=41
i=42
i=43
i=44
i=45
i=46
i=47
i=48
i=49
i=50
i=51
thread 'main' panicked at 'Error message: System or Device ran out of memory
Last error: In function af_load_image
In file src/api/c/imageio.cpp:393


 0# 0x00007F4FC1A299AF in /opt/arrayfire/lib/libafcuda.so.3
 1# 0x0000560F6F590AFF in target/debug/crash
 2# 0x0000560F6F590099 in target/debug/crash
 3# 0x0000560F6F5903AB in target/debug/crash
 4# 0x0000560F6F59031E in target/debug/crash
 5# 0x0000560F6F58FC41 in target/debug/crash
 6# 0x0000560F6F5A707F in target/debug/crash
 7# 0x0000560F6F58FC10 in target/debug/crash
 8# 0x0000560F6F5902EC in target/debug/crash
 9# 0x00007F4FFB823510 in /lib/x86_64-linux-gnu/libc.so.6
10# __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
11# 0x0000560F6F58FB15 in target/debug/crash
', /home/joe/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/arrayfire-3.8.0/src/core/error.rs:37:14
stack backtrace:
   0: rust_begin_unwind
             at /rustc/c07a8b4e09f356c7468b69c50cac7fc5b5000b8a/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/c07a8b4e09f356c7468b69c50cac7fc5b5000b8a/library/core/src/panicking.rs:142:14
   2: arrayfire::core::error::handle_error_general
             at /home/joe/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/arrayfire-3.8.0/src/core/error.rs:37:14
   3: arrayfire::core::error::Callback::call
             at /home/joe/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/arrayfire-3.8.0/src/core/error.rs:29:9
   4: arrayfire::core::error::HANDLE_ERROR
             at /home/joe/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/arrayfire-3.8.0/src/core/error.rs:95:5
   5: arrayfire::image::load_image
             at /home/joe/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/arrayfire-3.8.0/src/image/mod.rs:317:9
   6: crash::main
             at ./src/main.rs:6:17
   7: core::ops::function::FnOnce::call_once
             at /rustc/c07a8b4e09f356c7468b69c50cac7fc5b5000b8a/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
主要语言
Rust
星标
827
派生
59
PR 合并指标
30 天内没有已合并 PR

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

arrayfire/arrayfire-rust 的其他 Issue

查看 arrayfire/arrayfire-rust 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

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