title: Android Renderscript Allocation.USAGE_SHARED crash
body: <p>I am getting a crash while running my app which uses renderscript. Unfortunately, the logcat does not give any specific details.</p>
  
  <pre><code>b = Bitmap.createBitmap(ib.getWidth(), ib.getHeight(),ib.getConfig());
  
  Allocation mInAllocation = Allocation.createFromBitmap(mRS, inBitmap,
                  Allocation.MipmapControl.MIPMAP_NONE,Allocation.USAGE_SHARED);
  
  Allocation mOutAllocation2 = Allocation.createFromBitmap(mRS,
                   outBitmap, Allocation.MipmapControl.MIPMAP_NONE,
                   Allocation.USAGE_SHARED);
  </code></pre>
  
  <p>...execute an algorithm from .rs file and later do the below</p>
  
  <pre><code>mOutAllocation2.copyTo(outBitmap)`;
  </code></pre>
  
  <p>The same code sequence runs perfectly fine, when I used USAGE_SCRIPT flag instead of USAGE_SHARED for mOutAllocation2.</p>
  
  <p>Any help on why this could happen?</p>
  
  <p>I read in android docs that if the allocation is of the type USAGE_SHARED, then the copy operation from allocation to the bitmap (see above) is faster. 
  Currently, I am seeing copies from allocation to bitmaps running into secs for decently large images (8MP and above)</p>
  
  <p>I am using Nexus 10 (Android 4.3) currently. </p>