leonbloy / pngj

PNGJ : pure Java library for high performance PNG encoding
http://hjg.com.ar/pngj/
273 stars 52 forks source link

Memory allocations in PngHelperInternal.skipBytes #22

Closed leonbloy closed 9 years ago

leonbloy commented 9 years ago

From zelonew...@gmail.com on January 16, 2013 20:31:17

After running a test program in a memory profiler, I found that in the static PngHelperInternal.skipBytes method, a 32KB throwaway buffer is created in the first line -- each time the method is invoked. This is allocated each time skipBytes is used, which adds up to a fair amount of allocation over time.

To improve the memory behavior, the new byte[] allocation can be moved outside of the method, or better, perhaps the InputStream.skip(..) method could be used instead.

Original issue: http://code.google.com/p/pngj/issues/detail?id=22

leonbloy commented 9 years ago

From hgonzalez@gmail.com on January 16, 2013 16:21:27

Status: Accepted
Owner: hgonzalez@gmail.com
Labels: -Type-Defect Type-Enhancement

leonbloy commented 9 years ago

From hjg.com.ar@gmail.com on July 27, 2013 20:22:11

InputStream.skip(..) is used now

Status: Fixed
Owner: hjg.com.ar@gmail.com