<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Mar 14, 2017 at 9:20 AM, Clément Bera <span dir="ltr"><<a href="mailto:bera.clement@gmail.com" target="_blank">bera.clement@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2017-03-14 16:46 GMT+01:00 Eliot Miranda <span dir="ltr"><<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>></span>:<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"> <div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div style="color:rgb(0,0,0);font-size:14px">c) fixing the primitive so that it uses the scavenge and fullGC counters in the VM to detect if a GC occurred during one of the callbacks and would fail the primitive [if it detected that a GC had occurred in any of the surface functions].   The primitive would then simply be retried. </div><div style="color:rgb(0,0,0);font-size:14px"><br></div></div></div></div></div></blockquote></div></div></div></blockquote></div></div></div></blockquote><div><br></div><div>That's clearly the best solution unless someone figures out a better d) solution.</div></div></div></div></blockquote><div><br></div><div>+1 for failing the primitive.</div><div><br></div><div>Most of bitblt calls do not use the surface functions, and even the ones that do (e.g. cairo and opengl plugins) normally do not involve FFI callbacks, so they won't cause a GC. Hence detecting a GC and failing the primitive is the cheapest option, and handling the failure in the image is simple enough.</div><div><br></div><div>- Bert - </div></div></div></div>