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

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

问题描述

我正在开发一个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项目中打开查看器,尽管通常使用的内存较少,但是仍然可以使用不清除内存的相同行为,如

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.

推荐答案

您当前正在使用哪个版本的Viewer?在这里您可以查看查看器版本的最新更改列表,默认情况下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 Viewer中存在严重的内存泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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