设备上 Autodesk Forge 查看器中的严重内存泄漏 [英] Severe memory leaks in the Autodesk Forge viewer on devices

查看:29
本文介绍了设备上 Autodesk Forge 查看器中的严重内存泄漏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 Angular/Typescript 应用程序,它利用 Autodesk Forge 查看器在智能手机和平板电脑上显示建筑模型.应用程序本身运行顺利,但是当我关闭应用程序时出现问题.关闭应用程序后,我注意到几乎没有任何内存被释放,如下图所示(我在大约 8 秒标记处关闭应用程序),并且在打开查看器两三次后,它会耗尽内存和崩溃.当我关闭应用程序时,我按照 Forge 文档中的描述调用了 tearDown() 和 finish() 方法,并将对 Forge 查看器的所有可能引用设置为 null,但它们的内存泄漏仍然存在.这是我的查看器代码的主要部分:

I'm developing an Angular/ Typescript application that makes use of the Autodesk Forge viewer to display building models on smartphones and tablets. The application itself runs smoothly, but the problem occurs when I close the application. After closing the application, I notice that hardly any memory gets released, as can be seen in the image below (I close the application around the 8 seconds mark) and after opening the viewer for two or three more times it will run out of memory and crash. When I close the application, I call both the tearDown() and the finish() method as described in the Forge docs and set all possible references to the Forge viewer to null, but they memory leak still persists. This is the main chunk of my viewer code:

this.initOptions = {
    path: 'url to model',
    env: 'Local',
    useADP: false,
    extensions: [],
};

Autodesk.Viewing.Initializer(this.initOptions, () => {

    this.onEnvInitialized();
});

private onEnvInitialized() {

    this.viewer = new Autodesk.Viewing.Private.GuiViewer3D(this.viewerContainer.nativeElement, {});
    this.viewer.initialize();
    this.viewer.loadModel(this.initOptions.path, {}, (doc) => {
        // further forge viewer execution here
    }, (errorMsg) => {
        console.log(errorMsg);
    });
}

public ngOnDestroy() {

    // remove all eventlisteners
    this.initOptions = null;
    this.viewer.tearDown();
    this.viewer.finish();
    this.viewer = null;
}

这是一个已知问题和/或有什么方法可以在关闭后手动释放 Forge 查看器使用的内存?(这是用例的一部分,我必须能够在一个会话中依次打开三个以上的查看器.)

Is this a known issue and/ or is there some way I can manually release the memory used by the Forge viewer after closure? (It is part of the use case that I have to be able to open more than three viewers after each other in one session.)

更新 [19-09-17]

我尝试在一个新的、空的 angular2 项目中打开我的查看器,尽管通常使用的内存较少,但不清除内存的相同行为仍然适用,可以看出 此处.我确实注意到事件侦听器现在大大减少了.我还将 Forge Viewer 更新到 2.17 版本,同样的问题在这里仍然适用.

I tried opening my viewer in a fresh, empty angular2 project, and although less memory is being used in general, the same behavoir of not clearing the memory still applies, as can be seen here. I do notice that the event listeners are drastically reduced now. I also updated the Forge Viewer to version 2.17, and the same issue still applies here as well.

推荐答案

您当前使用的是哪个版本的查看器?在这里您可以看到查看器版本的最新更改列表,默认情况下 v2.17 具有内存限制.

What version of the Viewer are you currently using? Here you can see a list of the recent changes on the viewer version, v2.17 has a Memory Limit ON by default.

https://developer.autodesk.com/en/docs/viewer/v2/overview/changelog/

如果没有在控制台中通过输入 LMV_VIEWER_VERSION 定义查看器的版本,也可以检查查看器的版本

Also the version of the viewer can be checked if it is not been defined from the console by typing LMV_VIEWER_VERSION

这篇关于设备上 Autodesk Forge 查看器中的严重内存泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆