views:

69

answers:

2

I am having trouble with memory allocation during a stress/performance testing of a program. In the test, I tried to do loading/unloading same set of resources again and again. The error I got was "Error, #1000, out of memory". The stack trace was about URLLoader/onComplete and URLStream/readBytes. I checked the memory being used at the time of failure, it was less than the maximum amount that the program has used before. I don't think it's caused by memory leak because the memory used through time is pretty consistent (allocate when loading resources, deallocate, allocate, ...) Also, this problem happens kinda randomly. I am kind of stuck. Any suggestions?

+2  A: 

If you are using Flex Builder, use the flex profiler to get a better idea of memory being used by various objects.

Amarghosh
A: 

You can also monitor memory consumption with something as simple as ProcessExplore for Windows or Activity Monitor for Mac. If all you're doing is loading/unloading resources, and you are managing the life of these resources correctly (i.e. removing listeners, making available for garbage collection, etc), then you should see a very consistent peak/valley memory graph. If the memory continues to rise, you've got a leak. Be especially careful if the resources you are loading/unloading are bitmaps as bitmapdata tends to be a prime culprit in flash memory leaks. Good luck!

heavilyinvolved
it's way better to use flash' internal reporting, there's no guarantee flash will return the memory to the os once it's done with it.
grapefrukt
Perhaps... but using an OS memory profiler will uncover blatant memory leaks and can be a good place to start. I do agree with Amarghosh though that using the Flex Profiler is your best bet for uncovering the problem.
heavilyinvolved