php don't clean memory in a same execution... do you need all the file? do you open the same file some times?
If you don't need all the content of the file, use a fopen and search the pattern in your own ways...
If you open the same file some times, in a session or some sessions (withouth changes of the file), store the file in globals or session variables...
The last possibility is store the file in a BD, to do the same operations with SQL.