Allocation error checking for unionized grid

On openmc-users we saw [an error](https://groups.google.com/forum/?fromgroups=#!topic/openmc-users/pudKZtZbMVQ) that was probably due to running out of memory for a unionized energy grid.  This PR should cause OpenMC to output a more specific error message in some cases of memory errors.  Unfortunately, I wasn't able to reproduce the error so I can't confirm that this PR will actually fix the issue we saw, but it certainly won't make the issue worse.