The LUT garbage collection was running ad-hoc as a side effect of processing,
this is problematic since it could trigger during processing of other threads
that might be using or freeing the same fish leading to races. The new babl_gc
function is to be called from the main thread, at times when processing is not
occuring, calling babl_gc is not neccesary in short lived commandline tools
and similar.
fprintf (stdout, "\e[H\e[2J");
}
babl_fish_class_for_each (gc_fishes, &context);
- //malloc_trim (0);
- // is responsibility of higher layers
+}
+
+static long babl_conv_counter = 0;
+
+void
+babl_gc (void)
+{
+ if (babl_conv_counter > 1000 * 1000 * 10) // run gc every 10 megapixels
+ {
+ babl_conv_counter = 0;
+ babl_gc_fishes ();
+ //malloc_trim (0);
+ // is responsibility of higher layers
+ }
}
#define BABL_LIKELY(x) __builtin_expect(!!(x), 1)
}
else
{
- static long conv_counter = 0;
- conv_counter+=n;
- if (conv_counter > 1000 * 1000 * 10) // run gc every 10 megapixels
- {
- conv_counter = 0;
- babl_gc_fishes ();
- }
+ babl_conv_counter+=n;
}
process_conversion_path (babl->fish_path.conversion_list,
source,
BablFishProcess babl_fish_get_process (const Babl *babl);
+/**
+ * babl_gc: (skip)
+ *
+ * Do a babl fish garbage collection cycle, should only be called
+ * from the main thread with no concurrent babl processing in other
+ * threads in paralell.
+ *
+ * Since: babl-0.1.98
+ */
+void babl_gc (void);
+
+
/* values below this are stored associated with this value, it should also be
* used as a generic alpha zero epsilon in GEGL to keep the threshold effects
* on one known value.
babl_db_each
babl_formats_count
babl_format_class_for_each
+babl_gc
babl_model_class_for_each
babl_type_class_for_each
babl_conversion_class_for_each