Hi, I work on a game project. Recently, we run into a problem which we catch a "bad_alloc" exception when we load/unload different scenes for about three times.
Eachtime we load a scene, we first load the compressed .zip folder into the memory and then extract game objects from it. Since we don't have any memory profiler tool, I simply use the performance graph of Process Explorer to see what is going on:
- Run the game ==> ~620 MB
- Load the 1st scene ==> ~1.1 GB
- Unload it ==> ~620 MB
- Load the 2nd scene ==> ~1.1 GB
- Unload it ==> ~620 MB
- Load the 3rd scene ==> bad_alloc
I trace down to the new operator of each load. The loading of the compressed folder costs 100~120 MB memory itself, and the bad_alloc is throw from it at the 3rd load.
Our platform is installed with 2GB physics memory. It seems that we do not left anything behind after unloading the scene. Each compressed folder is about the same size. However, the new operator of the 3rd load just doesn't work.
I'm wondering, what's the possible meaning of this bad_alloc? Out of memory? or simply can't allocate a contiguous block of the required size? If it does have several possibility, how can I determine it?
Any help is apppreciated, thanks!