[ruby-cvs:73369] normal:r66268 (trunk): zlib (gzfile_write_raw): do not resize string after .write call

normal at ruby-lang.org normal at ruby-lang.org
Fri Dec 7 16:09:32 JST 2018


normal	2018-12-07 16:09:31 +0900 (Fri, 07 Dec 2018)

  New Revision: 66268

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66268

  Log:
    zlib (gzfile_write_raw): do not resize string after .write call
    
    Apparently, a component of Rails implements a buffering .write
    method which keeps the String buffer around and makes it unsafe
    for us to clear it after calling .write.
    
    This caused Rack::Deflater to give empty results when enabled.
    
    Fortunately, per r61631 / a55abcc0ca6f628fc05304f81e5a044d65ab4a68,
    this misguided optimization was only worth a small (0.5MB) savings
    and we still benefit from the majority of the memory savings in
    that change.
    
    Thanks to zunda for the bug report.
    
    [ruby-core:90133] [Bug #15356]
    
    Fixes: r61631 (commit a55abcc0ca6f628fc05304f81e5a044d65ab4a68)
           ("zlib: reduce garbage on gzip writes (deflate)")

  Modified files:
    trunk/ext/zlib/zlib.c
    trunk/test/zlib/test_zlib.rb


More information about the ruby-cvs mailing list