FLVPlayback组件内存问题

编程入门 行业动态 更新时间:2024-10-24 02:28:56
本文介绍了FLVPlayback组件内存问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的网站是完全基于Flash的,它四处移动它给了我的视频,我已经转换为FLV文件块的3D模型。我使用FLVPlayback组件来控制我的程序里面的视频。在运行使用System.totalMemory内存检查我注意到,每当加载视频,它会吃了一个内存块,甚至当我删除它所有的事件监听器(它们都是弱引用),从删除组件其母公司,停止视频和空的组件实例,它仍然不会给内存了。

My website is entirely flash based, it moves around a 3D model which was given to me as chunks of video that I've converted to FLV files. I'm using the FLVPlayback component to control the video inside of my program. While running memory checks using System.totalMemory I've noticed that whenever a video is loaded, it will eat up a chunk of memory and even when I remove all the event listeners from it(they are all weakly referenced), remove the component from its parent, stop the video and null the component instance, it still will not give that memory back.

这一直困扰着我,因为我开始工作,因为大量的视频用户可以潜在地实例化和负载在这个项目上。目前,每个视频被装入时,它需要新的FLVPlayback实例,但我看过,也许去了解这个问题的最好方法是简单地拥有一个全球性的FLVPlayback实例,只是重新加载新的视频到旧的实例,这样,将只有在应用程序的内存中的一个FLVPlayback组件。

This has been bothering me since I started working on this project because of the huge amount of video a user can potentially instantiate and load. Currently every video is loaded into a new FLVPlayback instance whenever it is required, but I have read that perhaps the best way to go about this problem is to simply have a global FLVPlayback instance and just reload the new video into the old instance, that way there would only be one FLVPlayback component in the application's memory.

有没有其他人碰到这个问题呢?你有没有发现比使用刚重新使用全局实例为每一个新的视频更好的解决方案?

Has anyone else run into this problem as well? Have you found a better solution than using a global instance that you just re-use for every new video?

推荐答案

您不能帮助内存问题太多,直到Flash会析构函数和明确的对象删除,很遗憾。看到这个主题:

You can't help the memory problems much until Flash adds destructors and explicit object deletion, unfortunately. See this thread:

stackoverflow/questions/34/unloading-a-bytearray-in-actionscript-3

stackoverflow/questions/34/unloading-a-bytearray-in-actionscript-3

有一个限制多少内存的Flash小程序可以使用;气相色谱似乎火在达到该限制。我已经看到了我的记忆,容易使用的小程序尽可能〜200MB,只是因为它们运行几个小时就结束和GC不希望在踢。

There's a limit to how much memory Flash applets can use; the GC seems to fire upon reaching that limit. I've seen my memory-easy applets use as much as ~200MB, just because they run for hours on end and the GC doesn't want to kick in.

哦,我不认为使用单一实例是一个完美的解决方案,无论是。目前,我只写一个dispose()函数,我的自定义类,等待着有一天,当它可以变成一个适当的析构函数。

Oh, and I don't think using a single instance is an elegant solution, either. Currently I just write a dispose() function for my custom classes, waiting for some day when it can be turned into a proper destructor.

更多推荐

FLVPlayback组件内存问题

本文发布于:2023-07-11 12:20:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1094040.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:组件   内存   FLVPlayback

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!