2 * Copyright 2001-2003 Ximian, Inc
3 * Copyright 2003-2010 Novell, Inc.
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 #ifndef __MONO_SGEN_MEMORY_GOVERNOR_H__
25 #define __MONO_SGEN_MEMORY_GOVERNOR_H__
28 void sgen_memgov_init (glong max_heap, glong soft_limit, gboolean debug_allowance, double min_allowance_ratio, double save_target) MONO_INTERNAL;
29 void sgen_memgov_release_space (mword size, int space) MONO_INTERNAL;
30 gboolean sgen_memgov_try_alloc_space (mword size, int space) MONO_INTERNAL;
32 /* GC trigger heuristics */
33 void sgen_memgov_minor_collection_start (void) MONO_INTERNAL;
34 void sgen_memgov_minor_collection_end (void) MONO_INTERNAL;
36 void sgen_memgov_major_collection_start (void) MONO_INTERNAL;
37 void sgen_memgov_major_collection_end (void) MONO_INTERNAL;
39 void sgen_memgov_collection_start (int generation) MONO_INTERNAL;
40 void sgen_memgov_collection_end (int generation, unsigned long pause_time, unsigned long bridge_pause_time) MONO_INTERNAL;
42 void sgen_register_major_sections_alloced (int num_sections) MONO_INTERNAL;
43 mword sgen_get_minor_collection_allowance (void) MONO_INTERNAL;
44 gboolean sgen_need_major_collection (mword space_needed) MONO_INTERNAL;
47 /* OS memory allocation */
48 void* sgen_alloc_os_memory (size_t size, int activate) MONO_INTERNAL;
49 void* sgen_alloc_os_memory_aligned (size_t size, mword alignment, gboolean activate) MONO_INTERNAL;
50 void sgen_free_os_memory (void *addr, size_t size) MONO_INTERNAL;