You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tested on jruby 1.7.25 (1.9.3p551) 2016-04-13 867cb81 on Java HotSpot(TM) 64-Bit Server VM 1.8.0_60-b27 +jit [darwin-x86_64] and jruby 1.7.19
Possibly present in all 1.7 versions
Expected Behavior
On MRI #deflate emits chunks as needed.
Actual Behavior
This buffers all output until finish is called.
Taken from Zip::Deflater.<< in rubyzip gem:
require 'zlib'
prng = Random.new
data = prng.bytes(2**20)
zlib_deflater = ::Zlib::Deflate.new(::Zlib::DEFAULT_COMPRESSION, -::Zlib::MAX_WBITS)
200.times do
buffer = zlib_deflater.deflate(data)
puts "output kB: #{buffer.bytesize / 1024.0}" unless buffer.empty?
end
buffer = zlib_deflater.finish
puts "output from finish kB: #{buffer.bytesize / 1024.0}" unless buffer.empty?
The text was updated successfully, but these errors were encountered:
Note that running this on recent Java 8 will just use a bunch of memory; I tried choking max heap down for this and the example from rubyzip/rubyzip#322 and it wasn't difficult to get OOM.
Environment
Tested on
jruby 1.7.25 (1.9.3p551) 2016-04-13 867cb81 on Java HotSpot(TM) 64-Bit Server VM 1.8.0_60-b27 +jit [darwin-x86_64]
andjruby 1.7.19
Possibly present in all 1.7 versions
Expected Behavior
On MRI
#deflate
emits chunks as needed.Actual Behavior
This buffers all output until
finish
is called.Taken from
Zip::Deflater.<<
inrubyzip
gem:The text was updated successfully, but these errors were encountered: