This content has been marked as final. Show 10 replies
Never heard about it. Most of the time something isn't removed.
Have you watched the memory use of the movie? Find it at "Tast-Manager"
and Systemperformance (don't know the right name ion english windows).
Take a look in the debugger and watch if some clips are not removed or
behave strange. As I said most of the time you forget to remove clips,
scripts or intervalls.
Thanks for your reply. That was my first thought too, however I don't think it's the problem for a few reasons:
-I modified the MovieClip prototype so that onLoad and onUnload keep a counter of how many MovieClips are alive, and it stays within the 45-50 range, even after the program slows down. I don't use intervals or assign scripts at runtime.
-The slowdown is really instantaneous. One frame takes ~30ms, then suddenly the next takes ~60. Forgetting to remove clips should cause gradual slowdown.
-This might be a misunderstanding of how Flash works, but I don't think an increase in the number of objects around should slow down the dummy loop I described in my first post.
I did check the task manager, and while the memory usage is fairly stable, the CPU usage jumps when the game slows down. Also, I noticed that it's taking up a lot of memory total, ~22 MB. An astounding 12 MB of that is from one big lookup table I have, which really shocked me - when I was guessing how much memory it would use, I based my guess off how much it would take in C (~1MB) and estimated maybe 100-200% overhead. Didn't think I'd be off by a factor of 12 :) Anyway, removal of the table make it take much longer for the program to slow down, about 2-3 minutes, but it still happens. I think this lends some credence to the garbage collection theory: the only thing that changed was the memory usage, since the table is just used to say how to use the draw commands, so the only logical effect on the program was that things were drawn in the wrong places.
there is a problem with the flash drawing api in as2 and as3. with each line/curve segment created, cpu usage increases. this effect is noticable once you get beyond 10,000 segments.
Well, I think you hit it on the head. I removed the draw calls, while still doing all the computation, and no slowdown. I'm off to try and find a workaround, thanks for your help :)
you're welcome. please follow-up in this forum if you find a work-around.
i tried many work-arounds in as2 with no resolution.
hm...you said it was a problem with as2 and 3, I don't know if this is how you meant it but is there an as1 drawing API wwith no bug? Would it be possible to include a bit of as1 code in a Flash 8 doc and just pass the drawing points to it from as2 code?
Otherwise, I think I'm just going to use bitmap fills, which should work for the particular type of drawing I'm doing.
the same issue exists using as1.
avoiding the drawing api altogether and using bitmaps to "draw" may be workable. it's something i have not tried. i'll run some tests today to see if that's a promising approach.
addendum: i just ran a quick test and using the bitmapdata class in as2: it is much faster than the drawing api and does not appear to suffer the slow-down with repeated use. more testing is needed.
there's no slowdown after millions of "drawings" using the bitmapdata class!!
I don't think it will work out for me...my game is 3D, so the bitmaps need to be skewed and scaled and stuff, and while I got it working, it's very slow.
Also, I think the drawing may not be the cause of my problem here. There's still the old 50% slowdown after the game runs for a while with the bitmaps, and I think perhaps the reason I didn't see the slowdown when I stopped drawing was that without drawing there's virtually nothing for flash to do anyway. Also, I remembered that I have actually done something similar before, just using the drawing API, that didn't have similar problems: http://www.newgrounds.com/portal/view/288800 (now why the heck doesn't that slow down :P)
Anwyay, I think I might try just starting from scratch and putting it back together piece by piece. I've been hunting this bug for more than two days now, and I'm getting sick of it :P thank you for your help, though
you're welcome. i'm sorry i wasn't able to help you.
but, if it's any consolation, this helped me.