Merge change 6846 into donut

* changes:
  Avoid memcpy's by using GetPrimitiveArrayCritical.