[OpenJDK 2D-Dev] RFR 8148886: SEGV in sun.java2d.marlin.Renderer._endRendering

Laurent Bourgès bourges.laurent at gmail.com
Fri Feb 19 08:14:29 UTC 2016

Dear Jim,

Please have a look to this updated webrev:

I fixed the javadoc in ReentrantContextProvider: see below.

2016-02-18 23:40 GMT+01:00 Jim Graham <james.graham at oracle.com>:

> I swear I thought I remember asking this before and getting an answer, but
> I can't find it.
> RenderContext line 49 - should that be "!= HARD" so that you keep a hard
> reference for SOFT as well?

This concerns the ArrayCacheHolder that gathers several ArrayCache
instances that may consume a lot of memory: for example, it holds large
primitive arrays in case of large shapes / images or very complex ones.

To minimize the memory footprint, I deliberately use a
WeakReference<ArrayCachesHolder>(holder) i.e. such large caches are "short
live" (always in GC's young generation or TLAB ?).

When the RendererContext is also kept in memory by a WeakReference, then it
is redundant to have 2 WeakReferences:
in this case, the forementioned statement set the USE_CACHE_HARD_REF to
true that makes a strong reference between the RendererContext and its
related ArrayCachesHolder.

Finally I still plan to rewrite the "ArrayCache" feature as a more generic
array cache as we discussed several times !
Probably it is time to do it now or after fixing the bug:

> Also, I just noticed a typo in the sample code in
> ReentrantContextProvider, shouldn't the constructor in the newContext()
> method be "new ReentrantContextImpl()"?  (TileState probably came from
> cutting and pasting from AAShapePipe.)

Good catch: fixed.

Besides I added a sample for ReentrantContextImpl:

  52  * - create a subclass ReentrantContextImpl to hold the thread state:
  53  *
  54  * static final class ReentrantContextImpl extends ReentrantContext {
  55  *     // specific cached data
  56  * }
  57  *

Moreover I checked that the sample code is valid as it compiles properly in
a new class.

PS: I will be on winter holidays (leaving tomorrow for 1 week), so I would
like to push this patch myself asap.
If it is not possible, could you please handle the review thread & push it
for me ?

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

More information about the 2d-dev mailing list