Changes between Version 2 and Version 3 of Ticket #15574
- Timestamp:
- 2017-11-20T05:42:31+01:00 (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #15574 – Description
v2 v3 37 37 ----- 38 38 The proposed patch makes an effort to determine the presumably available memory before loading an image. It reads width and height of an image without loading it and then checks 39 * if the image will presumabl e fit into half of the avail memory to the JVM it will let the default toolkit loadit as usual39 * if the image will presumably fit into half of the avail memory to the JVM loading is defered to the default toolkit as usual 40 40 * otherwise an instance of TJDecoder is used to load a scaled version (that will also not employ more than half of the available JVM heap space memory) 41 41 42 42 Not taking more than half of the memory available is especially necessary for the bilinear scaling to work as it duplicates the image buffer (worst case) in best fit mode. 43 43 44 In general, because of the deliberate checking for possible OOM conditions, JOSM will be less likely to hit such exceptions if large images are loaded (this applies to all image formats, not just JPEG, but for JPEGs the code will make a second attempt in loading the image instead of giving up on it).44 In general, because of the deliberate checking for possible OOM conditions, JOSM will be from now on less likely to hit such exceptions if large images are loaded (this applies to all image formats, not just JPEG, but for JPEGs the code will make a second attempt in loading the image, instead of giving up). 45 45 46 46 ----- 47 47 Future work: 48 Considering that bilinear scaling may be turned off through prefs, the constraint of not using more than half the available memory may be loosened. However, a dynamic check depending on the state bilin* options are in, might be a false friend: If this option is changed at runtime, but the image is not reloaded yet, it might have better been a static check (as is employed now in the patch).48 Considering that bilinear scaling may be turned off in prefs, the constraint of not using more than half the available memory may be loosened. However, a dynamic check depending on the state bilin* options are in, might need more work, i.e. if that option is changed during runtime and an image is loaded already employing more than half of the available memory, it may seem strange to do an expensive reload of the whole image, just because this scaling option changed. So for now, this check is not dependent on the scaling option used for ImageDisplay. 49 49 50 50 Pledge for further testing: