Pan
Pan

Reputation: 2101

What may cause heavy memory leak in short time

when our flash game is in scene A, the memory is stable about 800M(it loads almost all the role animations and role skill animations). But when toggle to scene B, the memory keep increasing to 1400M in one minute. I have watched the explorer and make sure it doesn't load any resource when the memory is increasing. And when I repeat it, the memory increase to 2000M and the explorer freeze, the page crashed.

So what may cause such heary memory leak in short time? I haven't met such problem before, any help will be appreciated.

Upvotes: 0

Views: 370

Answers (3)

Pan
Pan

Reputation: 2101

After some days's work, we finally find out the problem.

Before I ask the question, I have tried Scout and Profile but not work(because the problem not occurs). I guess only bitmapdata draw or copypixels functon was called in an infinite loop or in a enterframe event handler could such quick and big memory leak.

Then we found out how to repeat the problem in luck, it really makes it much easier to solve the problem.

So here is the procedure we solve the problem after we could repeat the problem.

  1. run the game in profile, and take a memory snapshot.

  2. repeat the problem, after the memory increase a lot, take a memory snapshot.

  3. find the loitering objects between the memory snapshot.

At last, the problem is an function was called in each frame when one skill appers. And in the function a bitmapdata was used to draw the role animation

Upvotes: 0

Pedrom
Pedrom

Reputation: 388

If using FlashBuilder you can run the profiler to try and track down memory leaks and watch how many instances are being created. There are other profiling tools out there if you are using another type of IDE.

If using flash professional you can check out this link Profiling tools in flash builder to improve the performance of flash professional projects

Upvotes: 0

Creative Magic
Creative Magic

Reputation: 3141

The question is not giving enough concrete information on what you're doing and thus it's hard to precisely what you' doing wrong.

But there are ways to deal with these situations:

Install Adobe Scout (http://gaming.adobe.com/technologies/scout/). This is a really good profiling tool to help you see what's going on in your app.

Enable telemetry data in your app. There are settings for that in both Flash Professional and Flash Builder. If you don't know how to enable it, please search the web since it's very well explained.

Run your app and look at Scout's panels to see what is happening and how the much memory, at what time you're allocating.

Other than that there are hundreds of reasons why the memory leaks. Just look at your code and understand when you call what and use profiling tools to know where to look.

Upvotes: 1

Related Questions