[OpenJDK 2D-Dev] sun.java2D.pisces big memory usage (waste ?)

Laurent Bourgès bourges.laurent at gmail.com
Fri Mar 22 10:56:19 UTC 2013

Dear all,

I recently profiled my swing application (Aspro2: http://www.jmmc.fr/aspro)
using the netbeans profiler (OpenJDK8 / linux x64) and in contrary to
Oracle JDK, it consumes a lot of memory in sun.java2D.pisces code as int[]
or float[] arrays:
- Helpers.widenArray : 25Mb
- Renderer<init>: 75 Mb (from AAShapePipe.draw)

Here are few profiler screenshots:

Aspro2 screenshot illustrating the plot that consumes a lot of memory:

My application uses jfreechart that calls graphics2D.draw(shape) where
shape is always a rectangle / line with antialiasing enabled.

Several questions:
- Why is the antialiasing performed in java code ? I mean is it possible to
use OpenGL or XRender pipelines to perform such tasks ?
- Is there some docs explaining the java2D code and the different
implementations (openjdk, oracle, xrender, opengl ...) ?
- how could I help improving that code (Renderer ...) to avoid so many
array allocations / resizing (array sizing or using a thread context object
to reuse allocated int[] / float[] arrays) ?

Does somebody work on that topic ? has some ideas to optimize that code
(pisces) ?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20130322/a112d713/attachment.html>

More information about the 2d-dev mailing list