function Start() {
var tmp = new System.Object[1024];
// make allocations in smaller blocks to avoid them to be treated in a special way, which is designed for large blocks
for (var i : int = 0; i < 1024; i++)
tmp[i] = new byte[1024];
// release reference
tmp = null;
}
It sounds exactly like what I’m looking for. But unfortunately I don’t understand it. I tried to alter it to fit my needs but without success. I don’t know what it is actually doing. Is it allocating 1.024K? I can’t see it in the profiler statistics.
My basic question is: Where do I have to change the script to make it pre-allocate 1MB?
I would then build a stair of 12 x 1MB and yield between the steps to get the desired steepness of my stair. I would have to release the 12 references all at once i suppose.
Maybe I’m confusing Allocation with Memory here. They have more indirectly to do with each other.
I would have a backdoor solution for my problem. But I’d like to test this Allocation-thing before.
Thank you very much!!!
Yeah I was able to build a stair exactly how I wanted it. And view it in the Unity Profiler. But unfortunately it had no effect on the graph in the Allocations Instrument. But at least I was able to make the App crash on the iPad with extreme values.
Anyway. Now I solved my problem with my other backdoor plan that i had.
But again, thanks a lot for the help and explaining the script!