Commit Graph

85 Commits

Author SHA1 Message Date
John Cupitt 702ed8298f check for blocked operations on cache lookup
We could return an operation from cache even after the operatuion had
been blocked. This was harmless, but could cause confusion.

see https://github.com/kleisauke/wasm-vips/pull/24
2022-09-04 16:35:00 +01:00
Kleis Auke Wolthuizen 0337c09700
Cleanup gettext handling (#2695)
Use GLib's i18n support instead of copying and pasting that
logic into its own header. This deprecates the vips/intl.h
header in favour of glib/gi18n.h.
2022-02-27 15:27:28 +00:00
Lovell Fuller 117dbd888a Set minimum glib dependency version of 2.40 (March 2014) 2021-02-24 21:59:21 +00:00
Kleis Auke Wolthuizen 9246094033 Fix function pointer cast issues
It is undefined behavior in C and C++ to cast a function pointer
to another type and call it that way. This does work in most native
platforms, however, despite it being UB, but in WASM it can fail.

See:
https://emscripten.org/docs/porting/guidelines/function_pointer_issues.html
2020-06-30 13:35:41 +02:00
John Cupitt aba15122d5 reduce default cache size
Now 100 operations by default.
2020-06-28 09:52:58 +01:00
John Cupitt c0c07ea003 fix invalidate tagging
The new tagging system was unreffing the wrong operation.

See https://github.com/libvips/libvips/issues/1494#issuecomment-565200939
2019-12-18 14:32:30 +00:00
John Cupitt d88ce970b7 make operation cache invalidation advisory
This patch makes operation cache invalidate advisory rather than
immediate. Operations set a mark on cache entries meaning "this entry is
no longer valid", then the entry is removed next time the operation
is looked up.

This breaks the loop (now the cache can remove operations, but operations
can't remove cache entries), so it should be safer (I think). Everything
is inside a mutex, at least.

see https://github.com/libvips/libvips/issues/1484
2019-11-28 17:41:35 +00:00
Yazan Medanat 90f578a05f Change jcupitt references to libvips. 2018-09-21 09:05:47 -07:00
John Cupitt 5649847836 make vips_cache_print_nolock() static
not needed in public API
2018-05-06 17:15:35 +01:00
Leonard Hecker 80a0a24cfa Fixed deadlock in vips_cache_drop_all if vips__cache_dump is true
Both vips_cache_drop_all and vips_cache_print acquire vips_cache_lock
on entry, but vips_cache_drop_all calls vips_cache_print internally if
vips__cache_dump is true, leading to a deadlock situation.
This commit solves the issue using one further level of indirection
and a new vips_cache_print_nolock function.
2018-05-06 12:47:41 +02:00
John Cupitt f9f717a843 add VIPS_ONCE and use it everywhere
Lovell's idea: save the function call in the most common case
2017-11-23 08:43:08 +00:00
John Cupitt 0193e23c64 only flatten in find_trim if there is an alpha
oops, flatten always flattens, it doesn't check for alpha first

see https://github.com/jcupitt/libvips/issues/670
2017-09-18 14:48:15 +01:00
John Cupitt 3d40769401 tiny cleanups 2017-09-15 10:39:06 +01:00
John Cupitt 906dc50462 add a note to the docs re. mem & files
note that the cache limits only apply to memory and files allocated by libvips
2017-09-11 16:33:37 +01:00
John Cupitt 5a26b8fc45 fix caching of vips_text()
it was never cached argh because the g_object_set() to set the default
value of an input param in _build changed the hah
2017-05-29 12:38:38 +01:00
John Cupitt c464503510 Merge branch 'master' into invalidate-on-load-error 2017-01-17 13:47:14 +00:00
John Cupitt c5e675f7db fix --vips-cache-max etc.
--vips-cache-max, --vips-cache-max-memory and --vips-cache-max-files were not
working and probably hadn't been for a while

vipsthumbnail.c turns off the operation cache, it's not useful for
the same operation repeated across many files
2017-01-10 14:12:24 +00:00
John Cupitt eb320f41e1 add VIPS_TRACE env var
to enable --vips-cache-trace
2016-09-12 11:01:40 +01:00
John Cupitt 1fbae62cf8 seems to work for jpg anyway
try some tests next
2016-05-05 20:07:17 +01:00
John Cupitt 9487efc5c3 small doc fix 2015-07-10 14:57:45 +01:00
John Cupitt 951019fcbc improve cache trace output
now shows '*' for cache hit, lists output args as well
2015-04-13 12:08:42 +01:00
John Cupitt 0d509604e5 more transfer annotations 2015-02-02 14:55:19 +00:00
John Cupitt eb5fee5e65 add lower-level cache access 2015-02-01 17:56:48 +00:00
John Cupitt 93ab9fd661 oop, cache fix 2015-01-29 14:13:51 +00:00
John Cupitt 57196ee702 fix an operation cache bug
when testing two operations for equality, need to check that both had an
optional arg set before testing the value
2015-01-29 13:47:14 +00:00
John Cupitt 1ce3b53a6d oops, double allocate
thanks Lovell
2014-09-20 09:53:00 +01:00
John Cupitt 006a5d2eb1 oop, dropped a * on the floor 2014-09-19 12:04:11 +01:00
John Cupitt 862d7f03ea tiny cache clean-up 2014-09-19 11:38:16 +01:00
Lovell Fuller 20ae6b8af7 Prevent non-critical race condition in op cache
First thread to add an operation 'wins'
2014-09-19 09:18:58 +01:00
John Cupitt bf56f8f203 oops, missed another NULL 2014-06-12 14:41:04 +01:00
John Cupitt 40e8025a55 more fixups to pass testsuite 2014-06-12 14:23:53 +01:00
John Cupitt d7bad8fd5b cache drops operations on invalidate
we can now enable the vips8 operation cache in nip2, woo!
2014-06-12 13:40:00 +01:00
Lovell Fuller a1b3820eb2 Make cache limits 'hard' rather than 'soft' using trim after add, not before 2014-05-12 21:30:30 +01:00
John Cupitt 5f0f188659 drop the default max operations
the cache defaulted to 10,000 operations, fine for nip2, not fine for
batch-style applications

thanks Rafael
2014-03-28 09:48:27 +00:00
John Cupitt 72271dae6d more compact trace output 2014-01-08 13:07:56 +00:00
John Cupitt 63c1efc3b4 fix blocking of caching of seq load
we were setting nocache too late for the cache to see, move nocache
logic to _build()
2013-11-09 11:38:32 +00:00
Benjamin Gilbert 8cc76a6ba3 Update address for Free Software Foundation
Also update LGPLv2.1 license text from the copy currently on the GNU
website.
2013-03-07 00:40:19 -05:00
John Cupitt 6e1e3d4be1 better cache trace, small fixes 2012-10-29 17:19:15 +00:00
John Cupitt f59b0f88f0 update for new g_value_get_schar() function 2012-10-23 14:36:42 +01:00
John Cupitt 7e3494f6eb new new g_thread*() API 2012-10-23 13:36:39 +01:00
John Cupitt fad78f8555 rework gthread usage
glib-2.32 deprecated g_mutex_new() ... use a compat function to hide
this change

also remove the --without-threads configure flag, gthread is now
compulsory, so there was no longer any point
2012-10-22 22:08:53 +01:00
John Cupitt 88c3f7ab7d fix compiler warnings
some compiler warnings appeared in a production build (assert()s
commented out, -Wall, and -O2)

thanks to Dmitry Roshchin for the report
2012-08-14 12:43:54 +01:00
John Cupitt 17f6489c0e Merge remote-tracking branch 'origin/7.28'
Conflicts:
	ChangeLog
	configure.in
	libvips/deprecated/im_csv2vips.c
2012-07-18 10:39:29 +01:00
John Cupitt 4171f2673d safer string equality in cache
it could segv if operations had strings which had been set to NULL
2012-07-17 10:10:34 +01:00
John Cupitt 643dc28950 turn on seq mode automatically in cli
cli operations turn on seq mode automatically when they can

vips_operation_get_flags() added: lets you attach a set of flags to an
operation

flags for now are "nocache" (replacing the old nocache system) and "seqential"

if vips_object_set_argument_from_string() from string sees "seq" flag on the
object for which it is setting the arg, it enables sequential mode

all operations which can run sequentially have been tagged

the operation printer knows about flags and can display them
2012-07-10 10:51:40 +01:00
John Cupitt 87e37e83e2 Merge remote-tracking branch 'origin/7.28'
Conflicts:
	libvips/iofuncs/generate.c
	libvips/iofuncs/init.c
	po/vips7.pot
2012-07-09 14:09:25 +01:00
John Cupitt 8582e40307 improve use from many threads
lock around the operation cache and the upstrea/downstream link system
so vips works when used from many threads: you can now create an image
in one thread and process it in another
2012-07-09 13:47:09 +01:00
John Cupitt 89527b80eb fix odd tile height + no overlap
dzsave with zero overlap and odd height was broken

also, fix cache init
2012-07-08 10:37:35 +01:00
John Cupitt cff8f44373 improve thread-safety
the cache and link thing now lock, so you can create images and process
them from several threads
2012-07-07 18:37:47 +01:00
John Cupitt 213b44894e Merge remote-tracking branch 'origin/7.28'
Conflicts:
	libvips/iofuncs/cache.c
2012-06-21 13:32:47 +01:00