Are there limitations on the amount of memory that

2020-03-01 20:11发布

问题:

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?

回答1:

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. :)



回答2:

Check how much you are using with:

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

and watch out for leaks!



回答3:

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:

  • Flex memory limit - how to configure
  • Unloading a ByteArray in Actionscript 3
  • http://www.craftymind.com/2008/04/09/kick-starting-the-garbage-collector-in-actionscript-3-with-air/

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?"



标签: flash memory