My game uses ~400 megabyte in all. When game starts I have a nice loading screen with a progress bar (which I update) and game load all arts using a mediatracker. The arts are png’s.
However, the peak RAM consumption is 750-800 Megabyte so that means even on 1 GB machines it can force swapping and this means very inconsistent and sometimes VERY slow loading time of the game.
The problem is, even if I make small portions of the art as in
readImages()
readImages2()
readImages3()
…
and let each one of those methods do WaitForAll the RAM returns very slowly to the System so when i get to that last method I am gonna get to the 800 MB usage spike.
Seemingly if I run the game again the System Cache will make it run faster but this only makes it worse for me since I need to reboot the system to get the “real deal loading time” again.
I have tried using System.gc() mid way through the “readimage” methods to return RAM so that I can avoid the spike but it does not work.
-
Is there a way to disbale System cache on XP?
-
Is there a way of avoiding this huge RAM spike by returning whatever memory being used to decompress a png or whatever the reason for the spike is?
-
Is it better to use waitforall at several locations or just add all arts and then to a final large waitforall?
-
Is there any difference using several mediatrackers loaded a small chunk each or use just one?