void-packages/srcpkgs/tracker3-miners/patches/dont-use-malloc-trim.patch

105 lines
3.0 KiB
Diff

Reason: This reverts 191cc5218b53fba85baec1c8c17bb246a74044c0 and
ccb0b4ebbff4dfacf17ea67ce56bb27c39741811. malloc_trim is glibc specific
API, so this causes the build to fail on musl.
Upstream: https://gitlab.gnome.org/GNOME/tracker-miners/-/issues/135
diff --git a/src/miners/fs/tracker-main.c b/src/miners/fs/tracker-main.c
index c60070d..220916d 100644
--- src/miners/fs/tracker-main.c
+++ src/miners/fs/tracker-main.c
@@ -57,7 +57,6 @@
static GMainLoop *main_loop;
static GDBusProxy *index_proxy;
static GPtrArray *proxy_folders;
-static guint cleanup_id;
static gint initial_sleep = -1;
static gboolean no_daemon;
@@ -433,37 +432,6 @@ miner_start (TrackerMiner *miner,
miner);
}
-static gboolean
-cleanup_cb (gpointer user_data)
-{
- /* Reclaim as much memory as possible */
- malloc_trim (0);
-
- cleanup_id = 0;
-
- return G_SOURCE_REMOVE;
-}
-
-#if GLIB_CHECK_VERSION (2, 64, 0)
-static void
-on_low_memory (GMemoryMonitor *monitor,
- GMemoryMonitorWarningLevel level,
- gpointer user_data)
-{
- if (level > G_MEMORY_MONITOR_WARNING_LEVEL_LOW)
- malloc_trim (0);
-}
-#endif
-
-static void
-miner_started_cb (TrackerMinerFS *fs)
-{
- if (cleanup_id) {
- g_source_remove (cleanup_id);
- cleanup_id = 0;
- }
-}
-
static void
miner_finished_cb (TrackerMinerFS *fs,
gdouble seconds_elapsed,
@@ -483,8 +451,6 @@ miner_finished_cb (TrackerMinerFS *fs,
TRUE);
}
- cleanup_id = g_timeout_add_seconds (30, cleanup_cb, NULL);
-
/* We're not sticking around for file updates, so stop
* the mainloop and exit.
*/
@@ -941,9 +907,6 @@ main (gint argc, gchar *argv[])
TrackerEndpointDBus *endpoint;
TrackerDomainOntology *domain_ontology;
GCancellable *cancellable;
-#if GLIB_CHECK_VERSION (2, 64, 0)
- GMemoryMonitor *memory_monitor;
-#endif
gchar *domain_name, *dbus_name;
main_loop = NULL;
@@ -1129,18 +1092,10 @@ main (gint argc, gchar *argv[])
tracker_miner_files_set_mtime_checking (TRACKER_MINER_FILES (miner_files), do_mtime_checking);
}
- g_signal_connect (miner_files, "started",
- G_CALLBACK (miner_started_cb),
- NULL);
g_signal_connect (miner_files, "finished",
G_CALLBACK (miner_finished_cb),
NULL);
-#if GLIB_CHECK_VERSION (2, 64, 0)
- memory_monitor = g_memory_monitor_dup_default ();
- g_signal_connect (memory_monitor, "low-memory-warning", on_low_memory, NULL);
-#endif
-
/* Preempt creation of graphs */
tracker_sparql_connection_update_async (tracker_miner_get_connection (miner_files),
"CREATE SILENT GRAPH tracker:FileSystem; "
@@ -1183,11 +1138,6 @@ main (gint argc, gchar *argv[])
tracker_sparql_connection_close (sparql_conn);
g_object_unref (sparql_conn);
-#if GLIB_CHECK_VERSION (2, 64, 0)
- g_signal_handlers_disconnect_by_func (memory_monitor, on_low_memory, NULL);
- g_object_unref (memory_monitor);
-#endif
-
g_print ("\nOK\n\n");
return EXIT_SUCCESS;