You could be running out of memory, as your array size is (in theory) only limited by the amount of memory allocated to the script.
Put ini_set('memory_limit', '1024M');
in the beginning of your script to set the memory limit to 1 GB. You may need to increase this even higher for best results.