Pass the --clr-memory-model flag on the command line instead of MONO_DEBUG so its...
[mono-project.git] / mono / metadata / mono-gc.h
blob247e32eaab98630da8627c57b11d5e72b150b647
1 /**
2 * \file
3 * GC related public interface
5 */
6 #ifndef __METADATA_MONO_GC_H__
7 #define __METADATA_MONO_GC_H__
9 #include <mono/metadata/object.h>
11 MONO_BEGIN_DECLS
13 typedef int (*MonoGCReferences) (MonoObject *obj, MonoClass *klass, uintptr_t size, uintptr_t num, MonoObject **refs, uintptr_t *offsets, void *data);
15 /**
16 * This enum is used by the profiler API when reporting root registration.
18 typedef enum {
19 /**
20 * Roots external to Mono. Embedders may only use this value.
22 MONO_ROOT_SOURCE_EXTERNAL = 0,
23 /**
24 * Thread call stack.
26 * The \c key parameter is a thread ID as a \c uintptr_t.
28 MONO_ROOT_SOURCE_STACK = 1,
29 /**
30 * Roots in the finalizer queue. This is a pseudo-root.
32 MONO_ROOT_SOURCE_FINALIZER_QUEUE = 2,
33 /**
34 * Managed \c static variables.
36 * The \c key parameter is a \c MonoVTable pointer.
38 MONO_ROOT_SOURCE_STATIC = 3,
39 /**
40 * Managed \c static variables with \c ThreadStaticAttribute.
42 * The \c key parameter is a thread ID as a \c uintptr_t.
44 MONO_ROOT_SOURCE_THREAD_STATIC = 4,
45 /**
46 * Managed \c static variables with \c ContextStaticAttribute.
48 * The \c key parameter is a \c MonoAppContext pointer.
50 MONO_ROOT_SOURCE_CONTEXT_STATIC = 5,
51 /**
52 * \c GCHandle structures.
54 MONO_ROOT_SOURCE_GC_HANDLE = 6,
55 /**
56 * Roots in the just-in-time compiler.
58 MONO_ROOT_SOURCE_JIT = 7,
59 /**
60 * Roots in the threading subsystem.
62 * The \c key parameter, if not \c NULL, is a thread ID as a \c uintptr_t.
64 MONO_ROOT_SOURCE_THREADING = 8,
65 /**
66 * Roots in application domains.
68 * The \c key parameter, if not \c NULL, is a \c MonoDomain pointer.
70 MONO_ROOT_SOURCE_DOMAIN = 9,
71 /**
72 * Roots in reflection code.
74 * The \c key parameter, if not \c NULL, is a \c MonoVTable pointer.
76 MONO_ROOT_SOURCE_REFLECTION = 10,
77 /**
78 * Roots from P/Invoke or other marshaling infrastructure.
80 MONO_ROOT_SOURCE_MARSHAL = 11,
81 /**
82 * Roots in the thread pool data structures.
84 MONO_ROOT_SOURCE_THREAD_POOL = 12,
85 /**
86 * Roots in the debugger agent.
88 MONO_ROOT_SOURCE_DEBUGGER = 13,
89 /**
90 * Roots in the runtime handle stack. This is a pseudo-root.
92 * The \c key parameter is a thread ID as a \c uintptr_t.
94 MONO_ROOT_SOURCE_HANDLE = 14,
95 /**
96 * Roots in the ephemeron arrays. This is a pseudo-root.
98 MONO_ROOT_SOURCE_EPHEMERON = 15,
99 } MonoGCRootSource;
101 typedef enum {
102 MONO_GC_HANDLE_TYPE_MIN = 0,
103 MONO_GC_HANDLE_WEAK = MONO_GC_HANDLE_TYPE_MIN,
104 MONO_GC_HANDLE_WEAK_TRACK_RESURRECTION,
105 MONO_GC_HANDLE_NORMAL,
106 MONO_GC_HANDLE_PINNED,
107 MONO_GC_HANDLE_TYPE_MAX,
108 } MonoGCHandleType;
110 MONO_API void mono_gc_collect (int generation);
111 MONO_API int mono_gc_max_generation (void);
112 MONO_API int mono_gc_get_generation (MonoObject *object);
113 MONO_API int mono_gc_collection_count (int generation);
114 MONO_API int64_t mono_gc_get_used_size (void);
115 MONO_API int64_t mono_gc_get_heap_size (void);
116 MONO_API MonoBoolean mono_gc_pending_finalizers (void);
117 MONO_API void mono_gc_finalize_notify (void);
118 MONO_API int mono_gc_invoke_finalizers (void);
119 /* heap walking is only valid in the pre-stop-world event callback */
120 MONO_API int mono_gc_walk_heap (int flags, MonoGCReferences callback, void *data);
122 MONO_END_DECLS
124 #endif /* __METADATA_MONO_GC_H__ */