2 * mono-gc.h: GC related public interface
5 #ifndef __METADATA_MONO_GC_H__
6 #define __METADATA_MONO_GC_H__
8 #include <mono/metadata/object.h>
12 typedef int (*MonoGCReferences
) (MonoObject
*obj
, MonoClass
*klass
, uintptr_t size
, uintptr_t num
, MonoObject
**refs
, uintptr_t *offsets
, void *data
);
15 // Roots external to Mono. Embedders may only use this value.
16 MONO_ROOT_SOURCE_EXTERNAL
= 0,
17 // Thread stack. Must not be used to register roots.
18 MONO_ROOT_SOURCE_STACK
= 1,
19 // Roots in the finalizer queue. Must not be used to register roots.
20 MONO_ROOT_SOURCE_FINALIZER_QUEUE
= 2,
21 // Managed static variables.
22 MONO_ROOT_SOURCE_STATIC
= 3,
23 // Static variables with ThreadStaticAttribute.
24 MONO_ROOT_SOURCE_THREAD_STATIC
= 4,
25 // Static variables with ContextStaticAttribute.
26 MONO_ROOT_SOURCE_CONTEXT_STATIC
= 5,
27 // GCHandle structures.
28 MONO_ROOT_SOURCE_GC_HANDLE
= 6,
29 // Roots in the just-in-time compiler.
30 MONO_ROOT_SOURCE_JIT
= 7,
31 // Roots in the threading subsystem.
32 MONO_ROOT_SOURCE_THREADING
= 8,
33 // Roots in application domains.
34 MONO_ROOT_SOURCE_DOMAIN
= 9,
35 // Roots in reflection code.
36 MONO_ROOT_SOURCE_REFLECTION
= 10,
37 // Roots from P/Invoke or other marshaling.
38 MONO_ROOT_SOURCE_MARSHAL
= 11,
39 // Roots in the thread pool data structures.
40 MONO_ROOT_SOURCE_THREAD_POOL
= 12,
41 // Roots in the debugger agent.
42 MONO_ROOT_SOURCE_DEBUGGER
= 13,
43 // Handle structures, used for object passed to internal functions
44 MONO_ROOT_SOURCE_HANDLE
= 14,
47 MONO_API
void mono_gc_collect (int generation
);
48 MONO_API
int mono_gc_max_generation (void);
49 MONO_API
int mono_gc_get_generation (MonoObject
*object
);
50 MONO_API
int mono_gc_collection_count (int generation
);
51 MONO_API
int64_t mono_gc_get_used_size (void);
52 MONO_API
int64_t mono_gc_get_heap_size (void);
53 MONO_API MonoBoolean
mono_gc_pending_finalizers (void);
54 MONO_API
void mono_gc_finalize_notify (void);
55 MONO_API
int mono_gc_invoke_finalizers (void);
56 /* heap walking is only valid in the pre-stop-world event callback */
57 MONO_API
int mono_gc_walk_heap (int flags
, MonoGCReferences callback
, void *data
);
61 #endif /* __METADATA_MONO_GC_H__ */