Hi all,
Although I've taken a break from it recently, I've made
a SPDY package for Go, and it generally works fine, but I've been having some memory use issues.
The package uses compress/zlib for both a reader and a writer, created as follows:
c, err := zlib.NewReaderDict(buf, spdyDict)
c, err := zlib.NewWriterLevelDict(buf, zlib.BestCompression, spdyDict)
The compression works fine, but the program's memory usage grows quite substantially and doesn't seem to drop. In a server using SPDY, the RAM usage
seems to grow to about 50 MB during the first five or so request cycles, and then plateaus. Since it doesn't grow indefinitely, it doesn't appear to be a leak,
but the memory isn't released during long periods of activity, which I would've expected. Nothing of the compression state is stored between connections,
so once a connection is ended, its memory (including the compression state) should be released.
Some profiling suggests that the vast bulk of the memory use comes from (IIRC) compress/flate.compressor.initDeflate().
Is there a known issue that's causing this, or am I doing something wrong? Or is this just a case of unavoidable overhead from zlib.BestCompression?
Many thanks,
Jamie