fix memory errors due to too-large memcpy in ArrayList
Merge pull request #1279 from dpoe/master

Memory errors resulting from too-large copy in ArrayList