leonbloy/pngj

Memory allocations in PngHelperInternal.skipBytes

Closed this issue · 2 comments

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

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

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

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