Hi I'm looking into the issues to expect if the Flash Player (version 10) is run over a long period of time, say 24+ hours.
I know that the player has issues with not performing garbage collection properly, and that the weak listener system is buggy.
I plan on having the flash app started/monitored using a watchdog/sentinal app written in C/C++/C#. So I plan on refreshing the app periodically.
Does anyone have recommended practices for running a flash player over that sort of time scale?
Memory leaks are probably the worst. If you manage to make an app run on a 100% stable memory level for 1 hour it should also run for 24 hour and more (if its activity is stable as well).
Flex's profiler is nice to look up for leaks and uncollected items ...
I think, you want to make an application run a long time not easily and not difficult. You must always free memory at interval 300ms ( use LocalConnection).
Related
I am trying to find out why my web application (.NET + Sitecore) takes so long to start, but dottrace makes it start faster.
The current startup time is about 270 seconds, but when I start application with dottrace it actually takes 30 seconds. This is reproducible every time including other developers machines.
I am using .NET 4 and IIS 10 (app pool runs as Network Service).
The performance depends on the Windows Kernel Timer resolution, and dotTrace changes the value of this timer to the minimum possible value. So if dotTrace makes your program faster, it may indicate that (for example) there are many Thread.Sleep(n) calls in your program, where "n" is a relatively small number (1-5-10-20 milliseconds). Do you have such calls in your application?
Using Version 48.0.2564.109 m.
We have a javascript web app (built with ExtJS). In Chrome, when we leave our app sitting there for a while, the GC starts going nuts. In Task Manager, you can see the CPU constantly spinning around 25%.
I took timeline snapshots and CPU profiles, and you can see the GC, about 10 times a seconds, try to collect memory, but collects 0B.
Our app is a large enterprise application and does use quite a bit of memory and updates the screen periodically.
But, there is absolutely no javascript code running during this time. So I can't see that it is something our app is actively doing
Does anyone know what could be triggering this?
It is killing performance of our app.
Also, it only happens when our tab is active. If you switch to a different tab, the CPU dies down and the GC stops.
Is there other data I need to collect to help determine this?
What is your app current JS heap size? You can check it by collecting timeline and enabling memory check box.
It looks like your app is close to the V8 memory limit, so V8 is trying to free some memory. If it is expected for the app to use that much memory, you can increase the limit on your host with something like: --js-flags="--max-old-space-size=2048"
Otherwise it might be just a memory leak in your code. Use heap profiler to hunt it down.
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
I am facing the follow problem :
- There is a calculation which is calculated complex maths during the loading of the application, and it is toking considerable long time ( about 20 seconds ) on which time the CPU is used nearly on 100% and the application look like it is frozen.
Since it is a mobile application, this must be prevented, even with the costs of extending the initial loading time, but there is not direct access to the calculating code since it is inside 3rd party library.
Is there a way to prevent AIR application most of CPU generally ?
On desktop, you would use the Workers API. Its pretty new, I'd recommend it for AS3 only projects. If you use flex, its better to wait a few months.
Workers is a multi-threading API, what allows you to make a UI and a Working thread. This will still use 100% of CPU, but UI won't stuck.. Here are some links to get you started:
Thibault Imbert - sneak peek,
Intro to as 3 workers,
AS3 Workers livedocs
However, on Mobile, you can't use workers, so you'd have to break your function apart, and insert some delays there, like callLater, or setTimeout. Its hard to compose a function like that, but if it has a loop, you can insert a callLater method after every x iteration. you can parametrize both x, and the delay of callLater function to achieve perfect solution. After callLater is called, the UI will be rendered, events will be generated and catched. If you don't need them, remove their listeners, or stop their propagation with a higher priority handler. If you need, I can post some source example of callLater in a loop.
I have built an online game system that depends on a timer that records how long it took a player to complete a challenge. It needs to be accurate to the millisecond. Their time is stored in a SQL database.
The problem is that when I use the Timer class, some players are ending up getting scores in the database of less than a second. (which is impossible, as most challenges would take at least 11 seconds to complete even in a perfect situation.)
What I have found is that if a player has too many browser windows open, and/or a slow computer, the flash game slows down actually affecting the timer speed itself. The timer is 'spinning' on screen so you can physically see the numbers slowing down.
It is frustrating that I cannot just open a second thread or do something to allow flash to keep accurate time regardless of whatever else is going on in the program. Any ideas?
Another way of tracking time is using getTimer() at the start of the game. Store the result in a variable. Another getTimer() call at the end of the game will let you calculate the amount of milliseconds that the game lasted.
Timer is (in theory) independent of framerate, so hopefully should execute "on time" even if the player slows the framerate (in heavy display update cases). Of course, Timer is still dependent somewhat on CPU load and will have some marginal inaccuracies. 10+ second inaccuracies? I doubt it. I think either
a) You are using an incorrect number for the timer counts (timer runs on milliseconds, not seconds). If you ran it every 50ms, you could calculate total time based on the number of ticks it got through * 50ms
b) Your users are using something like Tamper Data to pause the request and change their "score"
c) You've got another bug in the game that's causing the issue.
Impossible to tell without sample code. Got any?