Merge pull request #2819 from BrzVlad/fix-major-log
[mono.git] / mono / sgen / sgen-memory-governor.h
1 /*
2  * Copyright 2001-2003 Ximian, Inc
3  * Copyright 2003-2010 Novell, Inc.
4  *
5  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
6  */
7 #ifndef __MONO_SGEN_MEMORY_GOVERNOR_H__
8 #define __MONO_SGEN_MEMORY_GOVERNOR_H__
9
10 /* Heap limits */
11 void sgen_memgov_init (size_t max_heap, size_t soft_limit, gboolean debug_allowance, double min_allowance_ratio, double save_target);
12 void sgen_memgov_release_space (mword size, int space);
13 gboolean sgen_memgov_try_alloc_space (mword size, int space);
14
15 /* GC trigger heuristics */
16 void sgen_memgov_minor_collection_start (void);
17 void sgen_memgov_minor_collection_end (void);
18
19 void sgen_memgov_major_pre_sweep (void);
20 void sgen_memgov_major_post_sweep (void);
21 void sgen_memgov_major_collection_start (void);
22 void sgen_memgov_major_collection_end (gboolean forced);
23
24 void sgen_memgov_collection_start (int generation);
25 void sgen_memgov_collection_end (int generation, GGTimingInfo* info, int info_count);
26
27 gboolean sgen_need_major_collection (mword space_needed);
28
29
30 typedef enum {
31         SGEN_ALLOC_INTERNAL = 0,
32         SGEN_ALLOC_HEAP = 1,
33         SGEN_ALLOC_ACTIVATE = 2
34 } SgenAllocFlags;
35
36 /* OS memory allocation */
37 void* sgen_alloc_os_memory (size_t size, SgenAllocFlags flags, const char *assert_description);
38 void* sgen_alloc_os_memory_aligned (size_t size, mword alignment, SgenAllocFlags flags, const char *assert_description);
39 void sgen_free_os_memory (void *addr, size_t size, SgenAllocFlags flags);
40
41 /* Error handling */
42 void sgen_assert_memory_alloc (void *ptr, size_t requested_size, const char *assert_description);
43
44 #endif
45