Use vims allocate functions and check for error.