Main GraphicsMagick source repository
Revision | 0618a7e599f50610bb7c4a775b0c790e0e658efa (tree) |
---|---|
Time | 2022-01-22 09:21:25 |
Author | Bob Friesenhahn <bfriesen@Grap...> |
Commiter | Bob Friesenhahn |
JP2: Add missing jas_cleanup_thread(). Finagle memory limits.
@@ -1,7 +1,9 @@ | ||
1 | 1 | 2022-01-21 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> |
2 | 2 | |
3 | 3 | * 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. | |
5 | 7 | |
6 | 8 | 2022-01-16 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> |
7 | 9 |
@@ -543,7 +543,13 @@ | ||
543 | 543 | /* |
544 | 544 | Tell JasPer how much memory it could ever be allowed to use. |
545 | 545 | */ |
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 | + } | |
547 | 553 | |
548 | 554 | /* |
549 | 555 | Inform JasPer that app may be multi-threaded |
@@ -554,6 +560,7 @@ | ||
554 | 560 | if (jas_init_library() == 0) |
555 | 561 | { |
556 | 562 | jasper_initialized=MagickTrue; |
563 | + /* jas_set_debug_level(110); */ | |
557 | 564 | } |
558 | 565 | else |
559 | 566 | { |
@@ -982,6 +989,10 @@ | ||
982 | 989 | { |
983 | 990 | (void) jas_stream_close(jp2_stream); |
984 | 991 | 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 */ | |
985 | 996 | return(image); |
986 | 997 | } |
987 | 998 |
@@ -38,7 +38,9 @@ | ||
38 | 38 | <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> |
39 | 39 | <blockquote> |
40 | 40 | * 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> | |
42 | 44 | <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> |
43 | 45 | <blockquote> |
44 | 46 | <p>* coders/miff.c (ReadMIFFImage): Do not proceed to next image in |