#Error crashes tlsf_add_pool+66

1 messages · Page 1 of 1 (latest)

bronze fjord
#

Hello,
I am using Unity 6 (6000.0.42f1) and my game is running on multiple c# jobs. In editor is working everything ok, but on android build I am getting crashes and Android logcat is pointing to some c# jobs.

This is my job (simplified version):

[BurstCompile]
   struct Second_DoubleDensityRelaxation_Job : IJobFor
   {
       [NativeDisableParallelForRestriction]
       public NativeArray<float2> particles_positions;
       [ReadOnly]
       public float H;
       [ReadOnly]
       public KnnContainer tree;

       // The code actually running on the job
       public void Execute(int i)
       {
           NativeList<int> neighbours = new NativeList<int>(Allocator.Temp);
           findNeighbours(tree, particles_positions, i, H, neighbours);

           foreach(int id in neighbours){
               float2 rij = particles_positions[id] - particles_positions[i];
               float rij_length = math.length(rij);
               float q = rij_length / H;

               if(q == 0){
                   float2 repairVector = // some calculation  
                   particles_positions[id] += repairVector;
               }

               else if(q < 1){
                   float2 D = // some calculation
                   particles_positions[id] += D / 2;
               }
           }
       }
#

The findNeighbours function searches for the nearest neighbors for a given position in the KD tree from the KnnContainer tree variable. Again simplified version:

public void findNeighbours(KnnContainer tree, NativeArray<float2> particles_positions, int id, float queryRadius, NativeList<int> neighbours){

 float2 queryPosition = particles_positions[id];

 NativeQueue<QueryNode> nodePool = new NativeQueue<QueryNode>(Allocator.Temp);

float squaredRadius = queryRadius * queryRadius;

nodePool.Enqueue(new QueryNode(tree.m_rootNodeIndex[0], 
tree.RootNode.Bounds.ClosestPoint(queryPosition)));

 while(nodePool.Count > 0){
   queryNode = nodePool.Dequeue();
   node = tree.m_nodes[queryNode.NodeIndex];

   if(!node.Leaf){
       // saving another node to nativeQueue
       }
       else {
       // adding to neighbours nativeList

    }
 }
}
#

I am not disposing of the NativeList, NativeQueue because I read that with Allocator.Temp allocation, it's not necessary, and it gets removed after the job is completed. Do you see any reason for this crash? Is it caused by allocating NativeList and NativeQueue inside the job? Or is it caused by parallel writing to particles_positions?

Error from Android logcat: