THANK YOU! to Brian Flaherty!
I have experienced exactly the problem you describe for about one year -- sometimes I get "heap zone" error, sometimes iMovie just crashes.
On a 12-core Mac with 16GB RAM, I was outraged to be having problems with memory!
However, have just tried Brian's solution, and it looks like a winner!
Not only did iMovie export my 56-minute basketball-game film into a 1080 Quicktime movie, but it also did so in only ONE HOUR -- a process that had been taking AT LEAST SEVEN HOURS with the H.264 Best Quality setting. And the size of the file is about the same. (SEVEN HOURS on a 12-core Mac!! 😠)
I AM SO HAPPY! Apple should hire Brian, since he has figured out someething Apple Support has been unable to respond to for more than one year!
Thank you! Thank you! Thank you! Brian!!!! 🙂🙂😁😁😍😍