ActionScript 3 分析器和内存分析工具

发布于 2024-08-13 19:13:23 字数 105 浏览 10 评论 0原文

我正在使用 Adob​​e Flash CS 4,想知道是否有可用的分析器或内存分析工具? (动作脚本 3)。我知道有适用于 Flex 的工具,但是有适用于 Flash CS 4 的工具吗?谢谢。

I'm using Adobe Flash CS 4 and would like to know are there any profiler or memory analysis tools available for it ? (actionscript 3). I know there are available tools for Flex, but are there for Flash CS 4 instead? Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

淡淡的优雅 2024-08-20 19:13:23

我确信那里有一个程序,仍在寻找自己,但我在论坛上发现了这个

大多数 AS3 初学者都编写过一些东西,然后听说了内存泄漏。因此,首先我将介绍检测和修复现有代码中的泄漏的方法,然后讨论开始编程时要采取的预防措施。

那么如何知道你的程序是否有问题呢?最清楚的判断方法是判断它是否崩溃,但这非常不切实际。幸运的是,在 AS3 中我们有一个名为 System 的对象,它的属性告诉我们 Flash 运行的条件。例如,System.totalMemory 是运行程序的 Flash Player 实例所使用的计算机内存量。不同的平台以不同的方式确定System.totalMemory的值,因此我建议您在测量其值时一次只运行一个Flash播放器实例。

package {

    import flash.utils.Timer;
    import flash.system.System;

    public class SpitMem {
        var t:Timer = new Timer(0);
        var n:int, lastN:int;

        public function SpitMem():void {
            t.addEventListener("timer", spit2, false, 0, true);
        }

        private function spit1():void {
            trace(System.totalMemory);
        }

        private function spit2():void {
            n = System.totalMemory;
            if (n != lastN)
                trace(n);
            lastN = n;
        }
    }
}

如果您创建上面的 SpitMem 类的实例并运行代码,您可以在“输出”窗口中观察程序内存使用情况的波动。不过,这是很多信息,并且在这种格式中它无法让您清楚地了解程序如何使用其内存。

(注意上面 spit1() 和 spit2() 之间的区别。如果 System.totalMemory 没有改变,spit2() 不会输出它。稍后我将展示类似的逻辑如何将我们的数据变成更有用的东西。)

如果您在电子表格程序中制作数据图表,您会注意到它似乎总是在增加。这并不意味着您有内存泄漏。闪存的内置内存管理允许某些类型的数据保留下来,直到有适当的时间将其删除。这称为垃圾收集,对于大多数 Flash 项目来说,它会导致您的内存积累然后下降。这称为锯齿图,这是完全正常的。

I'm sure there is a program out there, still looking myself, but I found this on a forum:

Most AS3 beginners have programmed something and then heard about memory leaks. So first I'm going to cover ways to detect and fix leaks in preexisting code, and then talk about preventative measures to take when starting to program.

So how do you know if your program has an issue? The clearest way to tell is if it crashes, but that's very impractical. Fortunately, in AS3 we have an object called System whose properties tell us about the conditions under which Flash is running. System.totalMemory, for instance, is the amount of computer memory being used by the Flash Player instance that's running your program. Different platforms determine the value of System.totalMemory in different ways, so I suggest you only run one Flash player instance at a time when measuring its value.

package {

    import flash.utils.Timer;
    import flash.system.System;

    public class SpitMem {
        var t:Timer = new Timer(0);
        var n:int, lastN:int;

        public function SpitMem():void {
            t.addEventListener("timer", spit2, false, 0, true);
        }

        private function spit1():void {
            trace(System.totalMemory);
        }

        private function spit2():void {
            n = System.totalMemory;
            if (n != lastN)
                trace(n);
            lastN = n;
        }
    }
}

If you create an instance of the SpitMem class above and run your code, you can observe the fluctuations in your program's memory usage in the Output window. This is a lot of information, though, and in this format it cannot give you a clear picture of how your program is using its memory.

(Notice the difference above between spit1() and spit2(). spit2() won't output the System.totalMemory if it hasn't changed. Later I'll show how similar logic can turn our data into something more useful.)

If you make a graph of your data in a spreadsheet program, you'll notice that it always seems to be increasing. That doesn't mean that you have a memory leak. Flash's built-in memory management allows certain types of data to sit around until there is an appropriate time to get rid of it. This is called garbage collection, and for most Flash projects, it will cause your memory to accumulate and then dip down. This is called a sawtooth graph, and it's completely normal.

空‖城人不在 2024-08-20 19:13:23

这是用于 ActionScript 3 内存分析和分析的好工具 http://demonsterdebugger.com/

This is good tool for actionscript 3 memory analysis and profiling http://demonsterdebugger.com/

逆光下的微笑 2024-08-20 19:13:23

随着 Flash Player 10.1 预览版本的发布,Adobe 推出了一个为您进行内存监控的组件:内存监控组件

With the release of the Flash Player 10.1 preview builds, Adobe put out a component that does memory monitoring for you: Memory Monitoring Component

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文