[WinForms] Fix #18506 ActiveTracker, do not propagate message to control when it...
[mono-project.git] / mono / sgen / sgen-memory-governor.h
blobecb2cf690857a3acdf0bfedf321129fffc32a618
1 /**
2 * \file
3 * Copyright 2001-2003 Ximian, Inc
4 * Copyright 2003-2010 Novell, Inc.
6 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
7 */
8 #ifndef __MONO_SGEN_MEMORY_GOVERNOR_H__
9 #define __MONO_SGEN_MEMORY_GOVERNOR_H__
11 /* Heap limits */
12 void sgen_memgov_init (size_t max_heap, size_t soft_limit, gboolean debug_allowance, double min_allowance_ratio, double save_target);
13 void sgen_memgov_release_space (mword size, int space);
14 gboolean sgen_memgov_try_alloc_space (mword size, int space);
16 /* GC trigger heuristics */
17 void sgen_memgov_minor_collection_start (void);
18 void sgen_memgov_minor_collection_end (const char *reason, gboolean is_overflow);
20 void sgen_memgov_major_pre_sweep (void);
21 void sgen_memgov_major_post_sweep (mword used_slots_size);
22 void sgen_memgov_major_collection_start (gboolean concurrent, const char *reason);
23 void sgen_memgov_major_collection_end (gboolean forced, gboolean concurrent, const char *reason, gboolean is_overflow);
25 void sgen_memgov_collection_start (int generation);
26 void sgen_memgov_collection_end (int generation, gint64 stw);
28 gboolean sgen_need_major_collection (mword space_needed, gboolean *forced);
31 typedef enum {
32 SGEN_ALLOC_INTERNAL = 0,
33 SGEN_ALLOC_HEAP = 1,
34 SGEN_ALLOC_ACTIVATE = 2
35 } SgenAllocFlags;
37 typedef enum {
38 SGEN_LOG_NURSERY,
39 SGEN_LOG_MAJOR_SERIAL,
40 SGEN_LOG_MAJOR_CONC_START,
41 SGEN_LOG_MAJOR_CONC_FINISH,
42 SGEN_LOG_MAJOR_SWEEP_FINISH
43 } SgenLogType;
45 typedef struct {
46 SgenLogType type;
47 const char *reason;
48 gboolean is_overflow;
49 gint64 time;
50 mword promoted_size;
51 mword major_size;
52 mword major_size_in_use;
53 mword los_size;
54 mword los_size_in_use;
55 } SgenLogEntry;
57 /* OS memory allocation */
58 void* sgen_alloc_os_memory (size_t size, SgenAllocFlags flags, const char *assert_description, MonoMemAccountType type);
59 void* sgen_alloc_os_memory_aligned (size_t size, mword alignment, SgenAllocFlags flags, const char *assert_description, MonoMemAccountType type);
60 void sgen_free_os_memory (void *addr, size_t size, SgenAllocFlags flags, MonoMemAccountType type);
62 /* Error handling */
63 void sgen_assert_memory_alloc (void *ptr, size_t requested_size, const char *assert_description);
65 #endif