ENH: Double-check memory allocation