views:

1632

answers:

3

Are there any limitations on the amount of memory that the flash player can use? If you have a swf that over time gets a lot of data from the server, then more and more data will be kept in memory... Is there a limitation on this?

Thx, Lieven Cardoen

+2  A: 

Not in any version of Flash that runs on desktop PCs. As long as your application keeps using more memory, desktop Flash will keep requesting it from the OS, until the OS runs out of memory or something crashes. Of course you the developer should limit your memory usage as appropriate, but Flash won't force you to do so.

In Flash Lite (the mobile version designed for cell phones), the host application imposes preconfigured limits on memory usage, but that's probably not what you care about. :)

fenomas
What do you mean by desktop Flash? (standalone?)I was more interested in knowing if a browser would give the Flash Player limitations? Maybe I'll try our business flex application on a old pc...
Lieven Cardoen
Sorry, I'll clarify my answer as to what I mean by desktop Flash. Is the issue here that you want to impose limits, or you're afraid you'll exceed them? Or just checking whether there are any?
fenomas
Exceeding is the issue, fenomas. I would like to now if there's a limit on the amount of memory that can be used by the flash player. And if that limit is set by the flash player, the browser, the operating system or just dependent of the amount of memory in the PC.
Lieven Cardoen
The answer is as I wrote; there is no limit. Unless you're on a mobile phone, the Flash will just use more and more memory until it runs into whatever limitations the OS might impose (i.e., the same limitations it would impose on all apps).
fenomas
+4  A: 

Check how much you are using with:

trace("MEMORY USAGE: " + (System.totalMemory/1048576) + "MB");

and watch out for leaks!

Iain
Idd, will write some analytic tests to see how fast memory increases. thx
Lieven Cardoen
+1  A: 

Iain has the right answer about checking the totalMemory used.

You could probably use a paging system. Although more and more data is loaded from the server I don't think all the data is used at all times. You could get data from the server and gradually save on the client's computer in a SharedObject( watch out for silesize limitations though) and you would keep track of what data is available locally( say data from index 0 to 900). If the user wants to see data between 200 and 300 you get stored data( if it aleady stored of course) , if not request the data and inform the user that data is on it's way.

Here are a few handy link related totalMemory and the Garbage Collector:

But what I think is more suited since there a lot data from the server, might be this: "What is the safe limit of flash player’s memory on web scenario and how well is AS 3.0 bit manipulation?"

George Profenza