Use 64K as the maximum number of array entries
This is still an arbitary limit to avoid excessive memory consumption.
10000 is not enough for some use cases. Hopefully 64K works better.
Patch by Staffan Palmroos!
BUG: 371790
(cherry picked from commit ceaff5549038e60d1e180a1200d15fe76880772c)