Android - heapSize
in
Android Processing
•
5 months ago
How can I make use of more of my available memory? I have a tablet with 1G RAM, of which in idle state, about 500MB is free/available, but I have been getting "out of memory errors" in my processing app as I exceed the device's heapSize of 48MB. I have read that this is a limit set by phones/tablets, so what do programmers do if 48MB (or whatever size is set for the phone) isn't enough? Can the heapSize be changed from within an app - my reading so far seems to suggest not, so I'm hoping someone here on this forum might know.
I am reaching this limit as I incrementally expand an array holding 16-bit audio samples (building up drum loops). I can monitor the heap allocation and my app crashes out when I reach the heapSize. I would like to go to ~300MB,
Also... expand() may be creating a memory leak.. or I may just be using it incorrectly?
audioArray = (short[ ]) expand(audioArray, audioArray.length+offSet);
increases the heapSize each time I call it to increase the array size, but if I reduce the array size (using a negative number for the offset variable) the array length changes correctly but there is no release of memory from the heap... it just stays where it is. Is this a memory leak?
Hope someone can help!
Mark
1