#define GC_finalize_on_demand __imp_GC_finalize_on_demand
#endif
+#ifdef HAVE_VALGRIND_MEMCHECK_H
+#include <valgrind/memcheck.h>
+#endif
+
static int finalize_slot = -1;
static gboolean gc_disabled = FALSE;
g_ptr_array_free (objs, TRUE);
}
+ /* Process finalizers which are already in the queue */
+ GC_invoke_finalizers ();
+
/* printf ("DONE.\n"); */
SetEvent (req->done_event);
mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_GC, msg, (unsigned long)arg);
}
+static gboolean
+mono_running_on_valgrind (void)
+{
+#ifdef HAVE_VALGRIND_MEMCHECK_H
+ if (RUNNING_ON_VALGRIND)
+ return TRUE;
+ else
+ return FALSE;
+#else
+ return FALSE;
+#endif
+}
+
+
void mono_gc_init (void)
{
InitializeCriticalSection (&handle_section);
return;
}
+ /* valgrind does not play nicely with the GC,
+ * so, turn it off when we are under vg.
+ */
+ if (mono_running_on_valgrind ()) {
+ /* valgrind doesnt like g_warning for some reason... */
+ printf ("You are running under valgrind. Currently, valgrind does "
+ "not support the GC. This program will run with the GC "
+ "turned off. Your program may take up a fair amount of "
+ "memory. Also, finalizers will not be run.");
+
+ gc_disabled = TRUE;
+ return;
+ }
+
finalizer_event = CreateEvent (NULL, FALSE, FALSE, NULL);
pending_done_event = CreateEvent (NULL, TRUE, FALSE, NULL);
shutdown_event = CreateEvent (NULL, TRUE, FALSE, NULL);