## Internal Runtime Utility Functions

### SHA1 Signatures

`mono_sha1_init`
Syntax
mono_sha1_init

`mono_sha1_update`
Syntax
mono_sha1_update

`mono_sha1_get_digest_from_file`
Syntax
mono_sha1_get_digest_from_file

`mono_sha1_get_digest`
Syntax
mono_sha1_get_digest

`mono_sha1_final`
Syntax
mono_sha1_final

### MD5 Signatures

`mono_md5_init`
Syntax
mono_md5_init

`mono_md5_update`
Syntax
mono_md5_update

`mono_md5_get_digest_from_file`
Syntax
mono_md5_get_digest_from_file

`mono_md5_get_digest`
Syntax
mono_md5_get_digest

`mono_md5_final`
Syntax
mono_md5_final

`mono_digest_get_public_token`
Syntax
mono_digest_get_public_token

### Hashtables

`GHashTable` is used when you need to store object references into a hashtable, objects stored in a `MonoGHashTable` are properly tracked by the garbage collector.

The `MonoGHashTable` data type has the same API as the GLIB.
`mono_g_hash_table_destroy`
Syntax
mono_g_hash_table_destroy

`mono_g_hash_table_foreach`
Syntax
mono_g_hash_table_foreach

`mono_g_hash_table_foreach_remove`
Syntax
mono_g_hash_table_foreach_remove

`mono_g_hash_table_foreach_steal`
Syntax
mono_g_hash_table_foreach_steal

`mono_g_hash_table_insert`
Syntax
mono_g_hash_table_insert

`mono_g_hash_table_lookup`
Syntax
mono_g_hash_table_lookup

`mono_g_hash_table_lookup_extended`
Syntax
mono_g_hash_table_lookup_extended

`mono_g_hash_table_new`
Syntax
mono_g_hash_table_new

`mono_g_hash_table_new_full`
Syntax
mono_g_hash_table_new_full

`mono_g_hash_table_remap`
Syntax
mono_g_hash_table_remap

`mono_g_hash_table_remove`
Syntax
mono_g_hash_table_remove

`mono_g_hash_table_replace`
Syntax
mono_g_hash_table_replace

`mono_g_hash_table_size`
Syntax
mono_g_hash_table_size

`mono_g_hash_table_steal`
Syntax
mono_g_hash_table_steal

### Memory Pools

Memory pools are a convenient way of tracking memory allocations that are used for one specific task, they are also faster than using the standard memory allocation procedures, as they are designed to be used only by a single thread at a time.

`MonoMemPool` objects are not thread safe, which means that you should not share the objects across multiple threads without providing proper locking around it (unlike `malloc` and `free` which are thread safe).

When a `MonoMemPool` is released with `mono_mempool_destroy` all of the of the memory allocated from that memory pool with `mono_mempool_alloc` and `mono_mempool_alloc0` is released.
`mono_mempool_new`
Syntax
MonoMemPool* mono_mempool_new (void)

Return value
a new memory pool.
Description

`mono_mempool_destroy`
Syntax
void mono_mempool_destroy (MonoMemPool *pool)

Parameters

pool | the memory pool to destroy

Description

Free all memory associated with this pool.
`mono_mempool_alloc`
Syntax
gpointer mono_mempool_alloc (MonoMemPool *pool, guint size)

Parameters

pool | the memory pool to use
size | size of the memory block

Return value
the address of a newly allocated memory block.
Description

Allocates a new block of memory in pool.

`mono_mempool_alloc0`
Syntax
gpointer mono_mempool_alloc0 (MonoMemPool *pool, guint size)

Description

same as mono_mempool_alloc, but fills memory with zero.
`mono_mempool_empty`
Syntax
mono_mempool_empty

`mono_mempool_invalidate`
Syntax
void mono_mempool_invalidate (MonoMemPool *pool)

Parameters

pool | the memory pool to invalidate

Description

Fill the memory associated with this pool to 0x2a (42). Useful for debugging.
`mono_mempool_stats`
Syntax
void mono_mempool_stats (MonoMemPool *pool)

Parameters

pool | the momory pool we need stats for

Description

Print a few stats about the mempool: - Total memory allocated (malloced) by mem pool - Number of chunks/blocks memory is allocated in - How much memory is available to dispense before a new malloc must occur?
`mono_mempool_contains_addr`
Syntax
gboolean mono_mempool_contains_addr (MonoMemPool *pool, gpointer addr)

Description

Determines whenever ADDR is inside the memory used by the mempool.

### Bitsets

MonoBitsets are a set of routines used to manipulate sets of bits.
`mono_bitset_alloc_size`
Syntax
mono_bitset_alloc_size

`mono_bitset_clear`
Syntax
mono_bitset_clear

`mono_bitset_clear_all`
Syntax
mono_bitset_clear_all

`mono_bitset_clone`
Syntax
mono_bitset_clone

`mono_bitset_copyto`
Syntax
mono_bitset_copyto

`mono_bitset_count`
Syntax
mono_bitset_count

`mono_bitset_equal`
Syntax
mono_bitset_equal

`mono_bitset_find_first`
Syntax
mono_bitset_find_first

`mono_bitset_find_last`
Syntax
mono_bitset_find_last

`mono_bitset_find_start`
Syntax
mono_bitset_find_start

`mono_bitset_foreach`
Syntax
mono_bitset_foreach

`mono_bitset_free`
Syntax
mono_bitset_free

`mono_bitset_intersection`
Syntax
mono_bitset_intersection

`mono_bitset_invert`
Syntax
mono_bitset_invert

`mono_bitset_mem_new`
Syntax
mono_bitset_mem_new

`mono_bitset_new`
Syntax
mono_bitset_new

`mono_bitset_set`
Syntax
mono_bitset_set

`mono_bitset_set_all`
Syntax
mono_bitset_set_all

`mono_bitset_size`
Syntax
mono_bitset_size

`mono_bitset_sub`
Syntax
mono_bitset_sub

`mono_bitset_test`
Syntax
mono_bitset_test

`mono_bitset_test_bulk`
Syntax
mono_bitset_test_bulk

`mono_bitset_union`
Syntax
mono_bitset_union

`mono_bitset_find_first_unset`
Syntax
mono_bitset_find_first_unset

`mono_bitset_intersection_2`
Syntax
mono_bitset_intersection_2

### JIT utilities

`mono_signbit_double`
Syntax
mono_signbit_double

`mono_signbit_float`
Syntax
mono_signbit_float

### Function Pointers

To wrap a function pointer into something that the Mono runtime can consume, you should use the mono_create_ftnptr. This is only important if you plan on running on the IA64 architecture. Otherwise you can just use the function pointer address.
`mono_create_ftnptr`
Syntax
mono_create_ftnptr

## Notification Interface

This is an internal profiler interface. In general, users would not be using this interface, but would be using the profiler interface.

These methods must be called to notify the profiler of an event that must be recorded. Mono's JIT engine currently calls these routines, but if you are extending Mono in some way these are the methods that you might invoke to notify the profiler of an event.
`mono_profiler_load`
Syntax
void mono_profiler_load (const char *desc)

Parameters

desc | arguments to configure the profiler

Description

Invoke this method to initialize the profiler. This will drive the loading of the internal ("default") or any external profilers.

This routine is invoked by Mono's driver, but must be called manually if you embed Mono into your application.
`mono_profiler_allocation`
Syntax
mono_profiler_allocation

`mono_profiler_stat_hit`
Syntax
mono_profiler_stat_hit

`mono_profiler_thread_start`
Syntax
mono_profiler_thread_start

`mono_profiler_thread_end`
Syntax
mono_profiler_thread_end

`mono_profiler_appdomain_event`
Syntax
mono_profiler_appdomain_event

`mono_profiler_appdomain_loaded`
Syntax
mono_profiler_appdomain_loaded

`mono_profiler_assembly_event`
Syntax
mono_profiler_assembly_event

`mono_profiler_assembly_loaded`
Syntax
mono_profiler_assembly_loaded

`mono_profiler_class_event`
Syntax
mono_profiler_class_event

`mono_profiler_class_loaded`
Syntax
mono_profiler_class_loaded

`mono_profiler_code_transition`
Syntax
mono_profiler_code_transition

`mono_profiler_method_end_jit`
Syntax
mono_profiler_method_end_jit

`mono_profiler_method_enter`
Syntax
mono_profiler_method_enter

`mono_profiler_method_jit`
Syntax
mono_profiler_method_jit

`mono_profiler_method_leave`
Syntax
mono_profiler_method_leave

`mono_profiler_module_event`
Syntax
mono_profiler_module_event

`mono_profiler_module_loaded`
Syntax
mono_profiler_module_loaded

`mono_profiler_shutdown`
Syntax
mono_profiler_shutdown

`mono_profiler_startup`
Syntax
mono_profiler_startup

`mono_profiler_gc_event`
Syntax
mono_profiler_gc_event

`mono_profiler_gc_heap_resize`
Syntax
mono_profiler_gc_heap_resize

`mono_profiler_gc_event`
Syntax
mono_profiler_gc_event

`mono_profiler_gc_heap_resize`
Syntax
mono_profiler_gc_heap_resize