Improved memory management, and added checks for R user interrupt in grow method.