data_file = gzopen(filename.c_str(), "r");
gzopen doesn't decompress the data,
gzread decompresses as you read it.
I haven't found a simple statement of this fact in the zlib docs, but if you want to "prove" it to yourself create a large (several GB) compressed file, and then measure how quickly
gzopen returns. It "obviously" doesn't take the time required to decompress the whole file. If you look into how gzip compression is defined, you'll see that it's designed to be written and read as a stream, that is to say you don't need to decompress the whole file at once.