e.g., I almost wish I could stay locked up so I could continue to study.
It's not essential. Very generally speaking, you're more likely to need a comma if the sentence is long. In such a case, the comma can help the reader to 'find' and understand the two parts of the sentence.