Flash does not have enough memory. - actionscript-3

How can I solve it? I was about to run my fla. file then one message appeared and it state that the memory was not enough. How can I solve it?

Related

What happened when c++ program getting a runtime error?

Say, in C++, if dereferencing a pointer that pointing to a memory that already released, I will get a bad access message and back to OS. Can someone explain what happened there a little bit in detail? It is an interview question on OS/compiler.
Once you delete that memory however, C++ marks it as free and may hand it out to anyone that asks for it.
Because deleting a block of memory does not zero the value of all pointers that point to it. Deleting memory merely makes a note that the memory is available to be allocated for some other purpose. Until that happens, the memory may appear to be intact -- but you can't count on it, and on some compiler/runtime/architecture combinations, your program will behave differently -- it may even crash.

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.
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.
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
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.
run the game in profile, and take a memory snapshot.
repeat the problem, after the memory increase a lot, take a memory snapshot.
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

Do I Have a Memory Leak / Garbage Collection Bug?

I'm building an Air application, which, due to the workflow of the animators, needs to load a lot of external swf files.
I load them all via FileStream / Loader Objects at the boot process and then store them in an object for further use.
The instant they get loaded, I use a gotoAndStop(1) command to make them stop looping (the original files have no scripts whatsoever).
After the load process I can see the system memory go slowly but consistently up.
When I manually invoke Garbage Collection with the System.gc() command,
the memory gets cleared again.
If I let the application run for hours it seems the Garbage Collector does not run.
Any ideas what the problem might be? Or should I just forget about it and just occasionally run System.gc() manually?
Thanks a lot!
The Garbage Collector will only run when it needs to, so it is entierly possible that it would go a very long time before running (especially if you have a lot of RAM available).
The important thing is the memory is cleared when it is run. This tells me that you don't have a leak, as it can be cleared up.
Also, how are you measuring the system memory? If you are doing it through Task Manager those numbers aren't really to be relied upon.
I recommend Process Explorer . Monitor the 'Private Bytes' column instead.

Memory Problems with ActionScript

I am having trouble with memory allocation during a stress/performance testing of a program. In the test, I tried to do loading/unloading same set of resources again and again. The error I got was "Error, #1000, out of memory". The stack trace was about URLLoader/onComplete and URLStream/readBytes. I checked the memory being used at the time of failure, it was less than the maximum amount that the program has used before. I don't think it's caused by memory leak because the memory used through time is pretty consistent (allocate when loading resources, deallocate, allocate, ...) Also, this problem happens kinda randomly. I am kind of stuck. Any suggestions?
If you are using Flex Builder, use the flex profiler to get a better idea of memory being used by various objects.
You can also monitor memory consumption with something as simple as ProcessExplore for Windows or Activity Monitor for Mac. If all you're doing is loading/unloading resources, and you are managing the life of these resources correctly (i.e. removing listeners, making available for garbage collection, etc), then you should see a very consistent peak/valley memory graph. If the memory continues to rise, you've got a leak. Be especially careful if the resources you are loading/unloading are bitmaps as bitmapdata tends to be a prime culprit in flash memory leaks. Good luck!

Can I detect when the Garbage collector works?

Am working on a swing app.
I will experiance slowness after continuous half an hour of use.
can it because of GC running?
How can i find when the garbage collector runs through any jdk 1.5 commandline option?
Thanks
When you start Java with -XX:+PrintGC, it will print messages whenever it garbage-collects.
You can use jconsole.exe, which can be found in the bin directory of your jdk. It shows you a lot of details about your running JVM.
It's highly unlikely that the GC is causing observable problems. Once upon a time Java had a horribly slow GC that gave it a near-permanent bad reputation. That time is past.
What exactly is the slowness? A GC should really never take more than a fraction of a second, even for the rare full collection pass.
Edit: Even if the GC is running a measurable amount, it's likely only a symptom of the problem. Whatever code is placing that much demand on the GC would internally cause more slowness than the GC will.
The simplest way to investigate this if you use recent JDK is jvisualvm which allow you to attach to a running process. You can then see garbage collections, memory usage and profile if needed. (It is essentially the corresponding NetBeans functionality available as a standalone applciation in the JDK).
It complements and enhances jconsole!
(But what you describe may be excessive GC's caused by a memory leak in your program. Use jvisualvm to figure out)
I strongly doubt it's the GC you are seeing. As 280Z28 points out, the GC runs pretty fast usually (though can still kill performance if you're doing something wrong). Are you using the program in that time? If not, maybe you're a little low on memory and it got paged out? (leaving Eclipse running for longer than maybe half a day without using it results in a state I can't work anymore with it. On systems with little memory it might happen sooner).
GC itself probably is not the problem. However, if you have a memory leak, it might result in GC using all CPU trying to clear memory.
As everyone has mentioned previously, GC is almost certainly not the problem.
I'd try something like YJP (Your Java Profiler, free for 30 days) to profile your application and find out what is slowing down. A memory leak is a very possible cause.