39 Star 60 Fork 413

OpenHarmony / arkcompiler_runtime_core

 / 详情

[Bug]: [ArkTS] Memory leak when calling an interface method in a loop

已完成
创建于  
2024-05-23 22:47

发生了什么问题?

let A: Number = 1.0

interface I {
    // abstract method
    foo(p: Number): Number;

    // default method
    bar(p: Number): Number {
        return p * 4.0;
    }

    // static method
    static baz(): Number {
        return A * 10.0;
    }
}

class C implements I {
    fld1: Number;
    fld2: Number;

    // overridden interface method
    public override foo(p: Number): Number {
        this.fld1 = p;
        this.fld2 = this.fld1 * 2;
        return this.fld2;
    }
}

function main_run(): void {
    let c: C = new C();

    assert c.foo(2.0) == 4.0
    assert c.bar(2.0) == 8.0
    assert I.baz() == 10.0

    // module level scope is not affected
    assert A == 1.0
}

function main() {
    for (let i = 0; i < 5000; i++) {
        main_run()
    }
}

Run this sample:

$ bin/es2panda --thread=0 --opt-level=2 --extension=ets --gen-stdlib=false --output=/tmp/sample.abc sample.ets 
$ bin/ark --boot-panda-files=$PWD/plugins/ets/etsstdlib.abc --load-runtimes=ets --compiler-enable-jit=true /tmp/sample.abc ETSGLOBAL::main

ASSERTION FAILED: daemon_threads_cnt_ > 0 || mem_stats_s_->GetFootprint(SpaceType::SPACE_TYPE_INTERNAL) == 0
IN /home/vkopyl/arkcompiler_runtime_core/runtime/runtime.cpp:127: Destroy
ERRNO: 12 (Cannot allocate memory)
Backtrace [tid=1938658]:
#0 : 0x7fcabfc8afaa [TID 1d94e2] E/runtime: libdwarf error: DW_DLE_FIRST_DIE_NOT_CU (105)
[TID 1d94e2] E/runtime: libdwarf error: DW_DLE_FIRST_DIE_NOT_CU (105)
panda::Runtime::Destroy()+0x24a
#1 : 0x10001b011 panda::Main(int, char const**)+0x12a1
#2 : 0x7fcabe18c083 __libc_start_main+0xf3
#3 : 0x1000173fe _start+0x2e

期望行为是什么?

.

如何复现该缺陷

.

其他补充信息

版本或分支信息

  • master
  • Release 4.1
  • Release 4.0
  • Release 3.2

评论 (1)

isharonov 创建了任务
isharonov 添加了
 
bug
标签
展开全部操作日志

感谢提交Issue!关于Issue的交互操作,请访问OpenHarmony社区支持命令清单。如果有问题,请联系 @godmiaozi @peijiajun @Ishin Pavel @Vyacheslav Cherkashin 。如果需要调整订阅PR、Issue的变更状态,请访问链接

Thanks for submitting the issue. For more commands, please visit OpenHarmony Command List. If you have any questions, please refer to committer @godmiaozi @peijiajun @Ishin Pavel @Vyacheslav Cherkashin for help. If you need to change the subscription of a Pull Request or Issue, please visit the link.

openharmony_ci 添加了
 
waiting_for_assign
标签
isharonov 修改了标题
isharonov 修改了描述
isharonov 通过openharmony/arkcompiler_runtime_core Pull Request !1629任务状态待办的 修改为已完成

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(2)
7387629 openharmony ci 1656582662
1
https://gitee.com/openharmony/arkcompiler_runtime_core.git
git@gitee.com:openharmony/arkcompiler_runtime_core.git
openharmony
arkcompiler_runtime_core
arkcompiler_runtime_core

搜索帮助

344bd9b3 5694891 D2dac590 5694891