GraphicsMagick: JP2: Add missing jas_cleanup_thread(). Finagle ...
GraphicsMagick Commits <[email protected]>
| Newsgroups | gmane.comp.video.graphicsmagick.cvs |
|---|---|
| Message-ID | <mailman.4233.1642811783.1607.graphicsmagick-commit@lists.sourceforge.net> |
changeset 0618a7e599f5 in /hg/GraphicsMagick details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=0618a7e599f5 summary: JP2: Add missing jas_cleanup_thread(). Finagle memory limits. diffstat: ChangeLog | 4 +++- coders/jp2.c | 13 ++++++++++++- www/Changelog.html | 4 +++- 3 files changed, 18 insertions(+), 3 deletions(-) diffs (65 lines): diff -r e84d14172c09 -r 0618a7e599f5 ChangeLog --- a/ChangeLog Fri Jan 21 16:06:25 2022 -0600 +++ b/ChangeLog Fri Jan 21 18:21:25 2022 -0600 @@ -1,7 +1,9 @@ 2022-01-21 Bob Friesenhahn <[email protected]> * coders/jp2.c: Adaptations to work with Jasper 3.0.0's - jas_init_library() and other related functions. + jas_init_library() and other related functions. Add missing + jas_cleanup_thread(). Do not request a higher memory limit than + JasPer's own limit in order to avoid a warning. 2022-01-16 Bob Friesenhahn <[email protected]> diff -r e84d14172c09 -r 0618a7e599f5 coders/jp2.c --- a/coders/jp2.c Fri Jan 21 16:06:25 2022 -0600 +++ b/coders/jp2.c Fri Jan 21 18:21:25 2022 -0600 @@ -543,7 +543,13 @@ /* Tell JasPer how much memory it could ever be allowed to use. */ - jas_conf_set_max_mem_usage((size_t) GetMagickResourceLimit(MemoryResource)); + { + size_t max_mem_gm = (size_t) GetMagickResourceLimit(MemoryResource); + size_t max_mem_jas = jas_get_total_mem_size(); + if (max_mem_jas == 0) + max_mem_jas=max_mem_gm; + jas_conf_set_max_mem_usage(Min(max_mem_jas,max_mem_gm)); + } /* Inform JasPer that app may be multi-threaded @@ -554,6 +560,7 @@ if (jas_init_library() == 0) { jasper_initialized=MagickTrue; + /* jas_set_debug_level(110); */ } else { @@ -982,6 +989,10 @@ { (void) jas_stream_close(jp2_stream); jas_image_destroy(jp2_image); +#if HAVE_JAS_INIT_LIBRARY + /* Perform any per-thread clean-up for the JasPer library. */ + JAS_CLEANUP_THREAD(); +#endif /* if HAVE_JAS_INIT_LIBRARY */ return(image); } diff -r e84d14172c09 -r 0618a7e599f5 www/Changelog.html --- a/www/Changelog.html Fri Jan 21 16:06:25 2022 -0600 +++ b/www/Changelog.html Fri Jan 21 18:21:25 2022 -0600 @@ -38,7 +38,9 @@ <p>2022-01-21 Bob Friesenhahn <<a class="reference external" href="mailto:bfriesen%40simple.dallas.tx.us">bfriesen<span>@</span>simple<span>.</span>dallas<span>.</span>tx<span>.</span>us</a>></p> <blockquote> * coders/jp2.c: Adaptations to work with Jasper 3.0.0's -jas_init_library() and other related functions.</blockquote> +jas_init_library() and other related functions. Add missing +jas_cleanup_thread(). Do not request a higher memory limit than +JasPer's own limit in order to avoid a warning.</blockquote> <p>2022-01-16 Bob Friesenhahn <<a class="reference external" href="mailto:bfriesen%40simple.dallas.tx.us">bfriesen<span>@</span>simple<span>.</span>dallas<span>.</span>tx<span>.</span>us</a>></p> <blockquote> <p>* coders/miff.c (ReadMIFFImage): Do not proceed to next image in