Author Topic: AlienRunner Memory Ques  (Read 616 times)

Offline sushobhit

  • long
  • ***
  • Posts: 109
  • future is now
    • View Profile
    • ANDROID APPS
AlienRunner Memory Ques
« on: March 07, 2014, 07:07:02 am »
Hi Egon ,

Yesterday I downloaded AlienRunner source and was going through it in SurfaceCreated
there is piece of code something like this :
int[] memoryalloc = new int[1024*512*3];
memoryalloc[0] = 1; //use it
memoryalloc = null; // clean it
// 6 mb

Now as I can see here you are just creating 6 mb space in the memory(RAM) and then make that 6mb free
As memoryalloc is not used anywhere else then why are you doing this code.

Please help me understand and does it increase the efficency of APP

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: AlienRunner Memory Ques
« Reply #1 on: March 07, 2014, 07:29:26 am »
That dates back to Android 1.5, which had very bad garbage collection and memory allocation behaviour. That little trick helped the game to run more stable and with less hick-ups. It's pointless on current devices.