On Wed, 25 Nov 2026 18:05:49 GMT, Phil Race <[email protected]> wrote:

>> I confirmed the leak and that the suggested fix works and should be safe.
>> The idea for the test  (using FFM to measure the number of handles in use) 
>> is quite neat too, and worked very well for me.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Phil Race has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8397801

test/jdk/java/awt/print/PrinterJob/PrinterDCLeak.java line 81:

> 79:             }
> 80:         }
> 81:         if (((currCnt - startCnt) > ITERATIONS) && (growCnt == ITERATIONS 
> / TEST_ITERATION)) {

It seems it will fail only if "growCnt" is increased for every iterations. But 
since we are using System.gc() there might be a possibility that the count 
might decrease in one iteration, even though final count might be more,
for examplem, if it starts with 100 (baseline) and then sees 160 (1st) → 
155-(2nd) ->250 (3rd iteration) it can still pass despite a net increase of 150 
since in 2nd iteration, it has decreased..

maybe we can remove "growCnt" and just check if ((currCnt - startCnt) > 
ITERATIONS)

test/jdk/java/awt/print/PrinterJob/PrinterDCLeak.java line 100:

> 98:             attrs.add(new Destination(out.toURI()));
> 99:             job.print(attrs);
> 100:         } catch (Exception e) {

Is it ok to swallow this exception? I guess any printing failure we should 
propagate

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/34015#discussion_r4703857206
PR Review Comment: https://git.openjdk.org/jdk/pull/34015#discussion_r4703788910

Reply via email to