/** * mono_gc_get_managed_allocator_by_type: * * Return a managed allocator method corresponding to allocator type ATYPE. */ MonoMethod* mono_gc_get_managed_allocator_by_type (int atype) { int offset = -1; MonoMethod *res; MONO_THREAD_VAR_OFFSET (GC_thread_tls, offset); mono_tls_key_set_offset (TLS_KEY_BOEHM_GC_THREAD, offset); res = alloc_method_cache [atype]; if (res) return res; res = create_allocator (atype, TLS_KEY_BOEHM_GC_THREAD); mono_mutex_lock (&mono_gc_lock); if (alloc_method_cache [atype]) { mono_free_method (res); res = alloc_method_cache [atype]; } else { mono_memory_barrier (); alloc_method_cache [atype] = res; } mono_mutex_unlock (&mono_gc_lock); return res; }
MonoMethod* mono_gc_get_managed_allocator_by_type (int atype) { #ifdef MANAGED_ALLOCATION MonoMethod *res; if (!use_managed_allocator) return NULL; if (!mono_runtime_has_tls_get ()) return NULL; res = alloc_method_cache [atype]; if (res) return res; res = create_allocator (atype); LOCK_GC; if (alloc_method_cache [atype]) { mono_free_method (res); res = alloc_method_cache [atype]; } else { mono_memory_barrier (); alloc_method_cache [atype] = res; } UNLOCK_GC; return res; #else return NULL; #endif }
void CPipeServer::FreeMethod() { mono_free_method((void *)ReadQword()); }