* Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
* Copyright 2004-2009 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin Inc. (http://www.xamarin.com)
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#include <config.h>
initial_size = MONO_MEMPOOL_MINSIZE;
#endif
- pool = g_malloc (initial_size);
+ pool = (MonoMemPool *)g_malloc (initial_size);
pool->next = NULL;
pool->pos = (guint8*)pool + SIZEOF_MEM_POOL; // Start after header
static gboolean inited;
if (!inited) {
- mono_mutex_init_recursive (&mempool_tracing_lock);
+ mono_os_mutex_init_recursive (&mempool_tracing_lock);
inited = TRUE;
}
- mono_mutex_lock (&mempool_tracing_lock);
+ mono_os_mutex_lock (&mempool_tracing_lock);
g_print ("Allocating %d bytes\n", size);
symbols = backtrace (array, BACKTRACE_DEPTH);
names = backtrace_symbols (array, symbols);
g_print ("\t%s\n", names [i]);
}
free (names);
- mono_mutex_unlock (&mempool_tracing_lock);
+ mono_os_mutex_unlock (&mempool_tracing_lock);
}
#endif
// (In individual allocation mode, the constant will be 0 and this path will always be taken)
if (size >= MONO_MEMPOOL_PREFER_INDIVIDUAL_ALLOCATION_SIZE) {
guint new_size = SIZEOF_MEM_POOL + size;
- MonoMemPool *np = g_malloc (new_size);
+ MonoMemPool *np = (MonoMemPool *)g_malloc (new_size);
np->next = pool->next;
np->size = new_size;
} else {
// Notice: any unused memory at the end of the old head becomes simply abandoned in this case until the mempool is freed (see Bugzilla #35136)
guint new_size = get_next_size (pool, size);
- MonoMemPool *np = g_malloc (new_size);
+ MonoMemPool *np = (MonoMemPool *)g_malloc (new_size);
np->next = pool->next;
np->size = new_size;
return NULL;
l = strlen (s);
- res = mono_mempool_alloc (pool, l + 1);
+ res = (char *)mono_mempool_alloc (pool, l + 1);
memcpy (res, s, l + 1);
return res;