X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Futils%2Fmono-codeman.c;h=4efcea0ae25500addaca763aaa9bb3721d495734;hb=f97e03f284f239e14ab308800679c1b2f0b04f64;hp=33dc025df3ea6d33a37223627df72bbc48aac4fa;hpb=ee68c04c1079886c6df6be50e371e7d0a7c72c16;p=mono.git diff --git a/mono/utils/mono-codeman.c b/mono/utils/mono-codeman.c index 33dc025df3e..4efcea0ae25 100644 --- a/mono/utils/mono-codeman.c +++ b/mono/utils/mono-codeman.c @@ -13,6 +13,7 @@ #include "mono-codeman.h" #include "mono-mmap.h" +#include "mono-counters.h" #include "dlmalloc.h" #include #include @@ -25,6 +26,8 @@ #include #endif +static uintptr_t code_memory_used = 0; + /* * AMD64 processors maintain icache coherency only for pages which are * marked executable. Also, windows DEP requires us to obtain executable memory from @@ -284,6 +287,7 @@ free_chunklist (CodeChunk *chunk) } else if (dead->flags == CODE_FLAG_MALLOC) { dlfree (dead->data); } + code_memory_used -= dead->size; free (dead); } } @@ -451,6 +455,8 @@ new_codechunk (int dynamic, int size) chunk->bsize = bsize; mono_profiler_code_chunk_new((gpointer) chunk->data, chunk->size); + code_memory_used += chunk_size; + mono_runtime_resource_check_limit (MONO_RESOURCE_JIT_CODE, code_memory_used); /*printf ("code chunk at: %p\n", ptr);*/ return chunk; }