[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Integrated: 7001133: OutOfMemoryError by CustomMediaSizeName implementation
From:       Alexander Scherbatiy <alexsch () openjdk ! org>
Date:       2023-12-18 12:14:53
Message-ID: oYqqL9Ul85kg9oiuU65Qh2HUaeHQuPa2xKhdjGasJ3A=.8d2c3c82-3628-4119-adc7-f3f4b9047371 () github ! com
[Download RAW message or body]

On Thu, 12 Oct 2023 15:51:28 GMT, Alexander Scherbatiy <alexsch@openjdk.org> wrote:

> Each time `CUPSPrinter.initMedia()` method is called it creates new \
> `CustomMediaSizeName` objects which are all collected in static \
> `CustomMediaSizeName.customEnumTable` field. A lot of created duplicated \
> `CustomMediaSizeName` objects wastes java heap space and can lead to \
> `PrintService.getAttributes()` method call time degradation especially when a lot \
> of different printers are installed in the operation system. The same is true for \
> `CustomMediaTray` class. 
> The fix adds a `create()` method and a hash map which allows to reuse created  \
> `CustomMediaSizeName/CustomMediaTray` objects. It seems that adding `equals(...)` \
> method to `CustomMediaSizeName/CustomMediaTray` classes violates parent `Media` \
> class contract which compares media objects only by `value` fields. The fix adds \
> inner classes which are used as a key in corresponding hash maps. 
> `test/jdk/javax/print` and `test/jdk/java/awt/print` automated tests were run to \
> check the fix on Linux and macOS.

This pull request has now been integrated.

Changeset: 10335f60
Author:    Alexander Scherbatiy <alexsch@openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/10335f60f923aa4f315e64acb2bfd7bb06d47a1b
                
Stats:     173 lines in 5 files changed: 153 ins; 13 del; 7 mod

7001133: OutOfMemoryError by CustomMediaSizeName implementation

Reviewed-by: psadhukhan

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

PR: https://git.openjdk.org/jdk/pull/16167


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic