It's not bad practice whatsoever, and is either good application design or bad design depending on what you need from that file, and how often you need to grab stuff from it. If the data is no longer useful to the rest of the program's functionality, then obviously it becomes irrelevant and thus is no longer needed, and you probably should not keep it in memory anymore. If the file is large, then you shouldn't store the entire thing in memory though, and avoid the assumption that the RAM can hold it (keep in mind applications have to share this memory), and what you should instead do is read parts of the file in chunks and extract what you need at the time of the read operation.