The disadvantage of this resource allocation method is that all resources will be present in virtual memory for the duration of your application.
For example, if you have 10 levels in your game, using the more common file-based storage solution, you only load the data to the level you are going to play. By loading all the game data at run time, you allocate more RAM than necessary. A solution that uses an optimally minimal amount of RAM will load only the resources it needs for the required time.
However, if you used a file-based file storage solution for your resources and loaded them all at the beginning of execution, your RAM usage would be the same as the statically assigned resource method.
In addition, if your target machine is a simple game console that does not perform multitasking, you can usually freely use available resources in any way that suits you. There is no requirement to βplay well,β as usual, only one game works at a time.
If you are dealing with several megabytes in a modern system, the penalty is negligible, but the penalty for performance when using several gigabytes of data is that you create an unnecessary load on the available system memory resources.
edit: don't forget to see the points raised in the comments
source share