I have a 2D map in this format: (x,y,type,index) Which is fed into jmonkeyengine renderer from a Swing app. I used:
String map_array[10000][1000];
Example:
map_array[100][200]="E8";
Which means in position x=100 and y=200 there is an Enemy ("E") with index of 8. Its memory behavior is like this:
and in another way I made:
byte map_array[10000][1000][2];
Example:
map_array[100][200][0]='E';
map_array[100][200][1]='8';
Which has the same meaning of above example. Its memory behavior is like this:
My questions are:
- Why String has strange behavior of slow allocating and bounces (as you can see it gets more than 2 minutes to reach maximum though the game is running smoothly)?
- Byte method seems to be less memory consuming but which way is better?