Merge "Add exception check to AllocateInternalWithGc" into lmp-dev