views:

49

answers:

2

Hi I wrote an application in flash AS3, and when I trace from flash the total memory usage of the total application is only about 9MB, But at the same time Task Manager Shows the memory usage as 110MB. Around 100MB difference.

Flash Trace Method System.totalMemory difference of the Trace from the Beginning of the application to end of the application.

+1  A: 

The amount of memory used by the flash player isn't necessarily related to how much memory your application is using. The players memory usage depends on how much memory the os gives it and a number of other things, if you have plenty of free memory there's no reason not to have the flash player sit on some for when it's needed.

All in all, you only need to worry about the actual memory usage reported by System.totalMemory*

* But do note that it reports the memory used for all currently running flash apps

grapefrukt
the flash player only for my application, the concept was like that. the memory supplied by the os is not preditable, because the same time the user can open with other adobe items like photoshop, AI, dreamweaer etc etc. so in this case my application getting crashed. :(
coderex
i do not understand your comment at all.
grapefrukt
A: 

Internally Flash Player will garbage collect making System.totalMemory accurate for internal usage. But even when the memory is GC'd it isn't given right back to the system. In IE you can cause the browser to give the GC'd space back by minimizing the browser. So essentially the value you see in the Task Manager is a high water mark of memory usage. If you need that value to be lower then the only thing you can do is use less memory. For example, before loading / creating something new, wait until something else has been GC'd so that Flash Player doesn't allocate new memory for an instant. The challenge is in knowing when something has been actually GC'd. There isn't a good way to do that.

James Ward