I would add that building the document-term matrix requires intermediate / temporary data structures. 

And also an entire pass over the dataset is required to know the word-index mapping.