memory allocation in windows phone 7
Posted: Tue Nov 09, 2010 8:13 am
Hi,
I've been profiling my game based on BepuPhysics for windows phone, basing my tests in this article: http://player.microsoftpdc.com/Session/ ... 25791980b1
I've discovered that bepu generates a LOT (25%) of memory rellocation, and because of this the calls to the garbage collector generate serious performance issues. I would recommend the creators of the engine to watch the video above.
One important thing I've discovered profiling is that the use of the System.Collection.Generic.List<> needs to be avoided in XNA game, and this is more necessary in WP7, because the garbage collector is called when all the garbage has a size of just 1MB.
ss
The profiler doesn't show me the Bepu code, but it tells me that some Lists in this library create up to 20.000 instances in a gameplay that takes few seconds (robot strike bowling game). There are many authors saying that the List need to be replaced by typed arrays. All foreach statements also need to be replaced by for statements. It also better to have an array with 1000 elements, use and reuse its items as many times as possible because extending its capacity, that requires problematic rellocations.
So I would recomend to do some optimizations changes to the library if you want it to work in WP7.
I've been profiling my game based on BepuPhysics for windows phone, basing my tests in this article: http://player.microsoftpdc.com/Session/ ... 25791980b1
I've discovered that bepu generates a LOT (25%) of memory rellocation, and because of this the calls to the garbage collector generate serious performance issues. I would recommend the creators of the engine to watch the video above.
One important thing I've discovered profiling is that the use of the System.Collection.Generic.List<> needs to be avoided in XNA game, and this is more necessary in WP7, because the garbage collector is called when all the garbage has a size of just 1MB.
ss
The profiler doesn't show me the Bepu code, but it tells me that some Lists in this library create up to 20.000 instances in a gameplay that takes few seconds (robot strike bowling game). There are many authors saying that the List need to be replaced by typed arrays. All foreach statements also need to be replaced by for statements. It also better to have an array with 1000 elements, use and reuse its items as many times as possible because extending its capacity, that requires problematic rellocations.
So I would recomend to do some optimizations changes to the library if you want it to work in WP7.