• R/O
  • SSH

GM: Commit

Main GraphicsMagick source repository


Commit MetaInfo

Revision0618a7e599f50610bb7c4a775b0c790e0e658efa (tree)
Time2022-01-22 09:21:25
AuthorBob Friesenhahn <bfriesen@Grap...>
CommiterBob Friesenhahn

Log Message

JP2: Add missing jas_cleanup_thread(). Finagle memory limits.

Change Summary

Incremental Difference

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 @@
11 2022-01-21 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
22
33 * coders/jp2.c: Adaptations to work with Jasper 3.0.0's
4- jas_init_library() and other related functions.
4+ jas_init_library() and other related functions. Add missing
5+ jas_cleanup_thread(). Do not request a higher memory limit than
6+ JasPer's own limit in order to avoid a warning.
57
68 2022-01-16 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
79
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 @@
543543 /*
544544 Tell JasPer how much memory it could ever be allowed to use.
545545 */
546- jas_conf_set_max_mem_usage((size_t) GetMagickResourceLimit(MemoryResource));
546+ {
547+ size_t max_mem_gm = (size_t) GetMagickResourceLimit(MemoryResource);
548+ size_t max_mem_jas = jas_get_total_mem_size();
549+ if (max_mem_jas == 0)
550+ max_mem_jas=max_mem_gm;
551+ jas_conf_set_max_mem_usage(Min(max_mem_jas,max_mem_gm));
552+ }
547553
548554 /*
549555 Inform JasPer that app may be multi-threaded
@@ -554,6 +560,7 @@
554560 if (jas_init_library() == 0)
555561 {
556562 jasper_initialized=MagickTrue;
563+ /* jas_set_debug_level(110); */
557564 }
558565 else
559566 {
@@ -982,6 +989,10 @@
982989 {
983990 (void) jas_stream_close(jp2_stream);
984991 jas_image_destroy(jp2_image);
992+#if HAVE_JAS_INIT_LIBRARY
993+ /* Perform any per-thread clean-up for the JasPer library. */
994+ JAS_CLEANUP_THREAD();
995+#endif /* if HAVE_JAS_INIT_LIBRARY */
985996 return(image);
986997 }
987998
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 @@
3838 <p>2022-01-21 Bob Friesenhahn &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
3939 <blockquote>
4040 * coders/jp2.c: Adaptations to work with Jasper 3.0.0's
41-jas_init_library() and other related functions.</blockquote>
41+jas_init_library() and other related functions. Add missing
42+jas_cleanup_thread(). Do not request a higher memory limit than
43+JasPer's own limit in order to avoid a warning.</blockquote>
4244 <p>2022-01-16 Bob Friesenhahn &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
4345 <blockquote>
4446 <p>* coders/miff.c (ReadMIFFImage): Do not proceed to next image in
Show on old repository browser