MonoThreadInfo *info = mono_thread_info_current ();
buf_size = buf_size < 8192 ? 8192 : (buf_size > 65536 ? 65536 : buf_size);
- buf = (char *) malloc (buf_size);
+ buf = (char *) g_malloc (buf_size);
for (;;) {
remain = read (src_fd, buf, buf_size);
if (report_errors)
_wapi_set_last_error_from_errno ();
- free (buf);
+ g_free (buf);
return FALSE;
}
if (remain == 0) {
if (report_errors)
_wapi_set_last_error_from_errno ();
MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: write failed.", __func__);
- free (buf);
+ g_free (buf);
return FALSE;
}
}
}
- free (buf);
+ g_free (buf);
return TRUE ;
}
+ sizeof (info->dlpi_phnum))
return (-1);
- struct dl_phdr_info *cpy = calloc(1, sizeof(struct dl_phdr_info));
+ struct dl_phdr_info *cpy = g_calloc (1, sizeof(struct dl_phdr_info));
if (!cpy)
return (-1);
MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: inode=%d, filename=%s, address_start=%p, address_end=%p", __func__,
mod->inode, mod->filename, mod->address_start, mod->address_end);
- free(info);
+ g_free (info);
if (g_slist_find_custom (ret, mod, find_procmodule) == NULL) {
ret = g_slist_prepend (ret, mod);
if (sysctl(mib, 4, NULL, &size, NULL, 0) < 0)
return(ret);
- if ((pi = malloc(size)) == NULL)
+ if ((pi = g_malloc (size)) == NULL)
return(ret);
if (sysctl (mib, 4, pi, &size, NULL, 0) < 0) {
if (errno == ENOMEM) {
- free(pi);
+ g_free (pi);
MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Didn't allocate enough memory for kproc info", __func__);
}
return(ret);
if (strlen (pi->kp_proc.p_comm) > 0)
ret = g_strdup (pi->kp_proc.p_comm);
- free(pi);
+ g_free (pi);
#endif
#elif defined(USE_BSD_LOADER)
#if defined(__FreeBSD__)
return(ret);
}
- if ((pi = malloc(size)) == NULL)
+ if ((pi = g_malloc (size)) == NULL)
return(ret);
if (sysctl (mib, 4, pi, &size, NULL, 0) < 0) {
if (errno == ENOMEM) {
- free(pi);
+ g_free (pi);
MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Didn't allocate enough memory for kproc info", __func__);
}
return(ret);
if (strlen (pi->ki_comm) > 0)
ret = g_strdup (pi->ki_comm);
- free(pi);
+ g_free (pi);
#elif defined(__OpenBSD__)
mib [0] = CTL_KERN;
mib [1] = KERN_PROC;
return(ret);
}
- if ((pi = malloc(size)) == NULL)
+ if ((pi = g_malloc (size)) == NULL)
return(ret);
mib[5] = (int)(size / sizeof(struct kinfo_proc));
if ((sysctl (mib, 6, pi, &size, NULL, 0) < 0) ||
(size != sizeof (struct kinfo_proc))) {
if (errno == ENOMEM) {
- free(pi);
+ g_free (pi);
goto retry;
}
return(ret);
if (strlen (pi->p_comm) > 0)
ret = g_strdup (pi->p_comm);
- free(pi);
+ g_free (pi);
#endif
#elif defined(USE_HAIKU_LOADER)
image_info imageInfo;
newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs);
/* FIXME: Can just use realloc(). */
- pathv = (char **)(pglob->gl_pathv ? realloc((char *)pglob->gl_pathv, newsize) :
- malloc(newsize));
+ pathv = (char **)(pglob->gl_pathv ? g_realloc ((char *)pglob->gl_pathv, newsize) :
+ g_malloc (newsize));
if (pathv == NULL) {
if (pglob->gl_pathv) {
- free(pglob->gl_pathv);
+ g_free (pglob->gl_pathv);
pglob->gl_pathv = NULL;
}
return(WAPI_GLOB_NOSPACE);
*limitp += len;
if ((copy = (char *)malloc(len)) != NULL) {
if (g_Ctoc(path, copy, len)) {
- free(copy);
+ g_free (copy);
return(WAPI_GLOB_NOSPACE);
}
pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
pp = pglob->gl_pathv + pglob->gl_offs;
for (i = pglob->gl_pathc; i--; ++pp)
if (*pp)
- free(*pp);
- free(pglob->gl_pathv);
+ g_free (*pp);
+ g_free (pglob->gl_pathv);
pglob->gl_pathv = NULL;
}
}
if (!g_ascii_strcasecmp (retargetable, "yes")) {
flags |= ASSEMBLYREF_RETARGETABLE_FLAG;
} else if (g_ascii_strcasecmp (retargetable, "no")) {
- free (retargetable_uq);
+ g_free (retargetable_uq);
goto cleanup_and_fail;
}
- free (retargetable_uq);
+ g_free (retargetable_uq);
tmp++;
continue;
}
else if (!g_ascii_strcasecmp (procarch, "AMD64"))
arch = MONO_PROCESSOR_ARCHITECTURE_AMD64;
else {
- free (procarch_uq);
+ g_free (procarch_uq);
goto cleanup_and_fail;
}
- free (procarch_uq);
+ g_free (procarch_uq);
tmp++;
continue;
}
key_uq == NULL ? key : key_uq,
flags, arch, aname, save_public_key);
- free (dllname_uq);
- free (version_uq);
- free (culture_uq);
- free (token_uq);
- free (key_uq);
+ g_free (dllname_uq);
+ g_free (version_uq);
+ g_free (culture_uq);
+ g_free (token_uq);
+ g_free (key_uq);
g_strfreev (parts);
return res;
}
}
- free (messages);
+ g_free (messages);
return g_string_free (text, FALSE);
#else
return g_strdup ("");
if (strstr (codepage, "utf_8") != NULL)
*int_code_page |= 0x10000000;
- free (codepage);
+ g_free (codepage);
if (want_name && *int_code_page == -1)
return mono_string_new (mono_domain_get (), cset);
len += bytes_converted + 1;
}
- darwin_locale = (char *) malloc (len + 1);
+ darwin_locale = (char *) g_malloc (len + 1);
CFStringGetBytes (locale_language, CFRangeMake (0, CFStringGetLength (locale_language)), kCFStringEncodingMacRoman, 0, FALSE, (UInt8 *) darwin_locale, len, &bytes_converted);
darwin_locale[bytes_converted] = '-';
if (locale_cfstr) {
len = CFStringGetMaximumSizeForEncoding (CFStringGetLength (locale_cfstr), kCFStringEncodingMacRoman) + 1;
- darwin_locale = (char *) malloc (len);
+ darwin_locale = (char *) g_malloc (len);
if (!CFStringGetCString (locale_cfstr, darwin_locale, len, kCFStringEncodingMacRoman)) {
- free (darwin_locale);
+ g_free (darwin_locale);
CFRelease (locale);
darwin_locale = NULL;
return NULL;
if (klass->element_class->byval_arg.type == MONO_TYPE_CLASS) {
for(i = 0; i < array->max_length; ++i)
mono_marshal_free_ccw (mono_array_get (array, MonoObject*, i));
- free(nativeArray);
+ g_free (nativeArray);
}
#endif
}
for (i = 1; i < symbols; ++i) {
g_print ("\t%s\n", names [i]);
}
- free (names);
+ g_free (names);
mono_os_mutex_unlock (&mempool_tracing_lock);
}
return FALSE;
// Allocate suffcient memory for available data based on the previous sysctl call
- if ((buf = malloc(needed)) == NULL)
+ if ((buf = g_malloc (needed)) == NULL)
return FALSE;
// Second sysctl call to retrieve data into appropriately sized buffer
mono_array_setref (*gw_addr_list, gwnum, addr_string);
gwnum++;
}
- free(buf);
+ g_free (buf);
return TRUE;
}
void *
mono_gc_alloc_obj (MonoVTable *vtable, size_t size)
{
- MonoObject *obj = calloc (1, size);
+ MonoObject *obj = g_calloc (1, size);
obj->vtable = vtable;
void *
mono_gc_alloc_vector (MonoVTable *vtable, size_t size, uintptr_t max_length)
{
- MonoArray *obj = calloc (1, size);
+ MonoArray *obj = g_calloc (1, size);
obj->obj.vtable = vtable;
obj->max_length = max_length;
void *
mono_gc_alloc_array (MonoVTable *vtable, size_t size, uintptr_t max_length, uintptr_t bounds_size)
{
- MonoArray *obj = calloc (1, size);
+ MonoArray *obj = g_calloc (1, size);
obj->obj.vtable = vtable;
obj->max_length = max_length;
void *
mono_gc_alloc_string (MonoVTable *vtable, size_t size, gint32 len)
{
- MonoString *obj = calloc (1, size);
+ MonoString *obj = g_calloc (1, size);
obj->object.vtable = vtable;
obj->length = len;
break;
}
- free (hashes_start);
+ g_free (hashes_start);
/* Report the result */
return c % MONO_IMT_SIZE;
}
imt_emit_ir (sorted_array, 0, number_of_entries, result);
- free (sorted_array);
+ g_free (sorted_array);
return result;
}
entry = next;
}
}
- free (imt_builder);
+ g_free (imt_builder);
/* we OR the bitmap since we may build just a single imt slot at a time */
vt->imt_collisions_bitmap |= imt_collisions_bitmap;
}
mono_gc_alloc_fixed (size_t size, MonoGCDescriptor descr, MonoGCRootSource source, const char *msg)
{
/* FIXME: do a single allocation */
- void *res = calloc (1, size);
+ void *res = g_calloc (1, size);
if (!res)
return NULL;
if (!mono_gc_register_root ((char *)res, size, descr, source, msg)) {
- free (res);
+ g_free (res);
res = NULL;
}
return res;
mono_gc_free_fixed (void* addr)
{
mono_gc_deregister_root ((char *)addr);
- free (addr);
+ g_free (addr);
}
/*
break;
}
- free (hashes_start);
+ g_free (hashes_start);
return c;
}
for (i =0; i < size; ++i) {
mono_runtime_printf_err ("\t%s", names [i]);
}
- free (names);
+ g_free (names);
/* Try to get more meaningful information using gdb */
/* we resolved an unknown class (unless we had the code unloaded) */
if (cd) {
/*printf ("resolved unknown: %s\n", name);*/
- free (cd->name);
+ g_free (cd->name);
cd->name = pstrdup (name);
return cd;
}
cd->code = code;
cd->len = len;
/*printf ("resolved unknown: %s\n", name);*/
- free (cd->name);
+ g_free (cd->name);
cd->name = pstrdup (name);
return cd;
}
add_rev_class_hashed (n, to->rev_hash_size, to->rev_hash [i].klass, to->rev_hash [i].count);
}
if (to->rev_hash)
- free (to->rev_hash);
+ g_free (to->rev_hash);
to->rev_hash = n;
}
to->rev_count += add_rev_class_hashed (to->rev_hash, to->rev_hash_size, from, 1);
add_heap_hashed (n, &res, hs->hash_size, hs->class_hash [i]->klass, hs->class_hash [i]->total_size, hs->class_hash [i]->count);
}
if (hs->class_hash)
- free (hs->class_hash);
+ g_free (hs->class_hash);
hs->class_hash = n;
}
res = NULL;
HeapObjectDesc* ho = alloc_heap_obj (objaddr, hash [i]->hklass, hash [i]->num_refs + num);
*ref_offset = hash [i]->num_refs;
memcpy (ho->refs, hash [i]->refs, hash [i]->num_refs * sizeof (uintptr_t));
- free (hash [i]);
+ g_free (hash [i]);
hash [i] = ho;
return ho;
}
add_heap_hashed_obj (n, hs->objects_hash_size, hs->objects_hash [i]);
}
if (hs->objects_hash)
- free (hs->objects_hash);
+ g_free (hs->objects_hash);
hs->objects_hash = n;
}
hs->objects_count += add_heap_hashed_obj (hs->objects_hash, hs->objects_hash_size, obj);
}
}
fprintf (outfile, "Total unmarked: %zd/%zd\n", num_unmarked, hs->objects_count);
- free (marks);
+ g_free (marks);
}
static void
for (i = 0; i < hs->objects_hash_size; ++i) {
HeapObjectDesc *ho = hs->objects_hash [i];
if (ho)
- free (ho);
+ g_free (ho);
}
if (hs->objects_hash)
- free (hs->objects_hash);
+ g_free (hs->objects_hash);
hs->objects_hash = NULL;
hs->objects_hash_size = 0;
hs->objects_count = 0;
add_trace_hashed (n, trace->size, trace->traces [i].bt, trace->traces [i].count);
}
if (trace->traces)
- free (trace->traces);
+ g_free (trace->traces);
trace->traces = n;
}
trace->count += add_trace_hashed (trace->traces, trace->size, bt, value);
if (debug)
fprintf (outfile, "handle (%s) %u created for object %p\n", get_handle_name (htype), handle, (void*)OBJ_ADDR (objdiff));
if (frames != sframes)
- free (frames);
+ g_free (frames);
} else if (subtype == TYPE_GC_HANDLE_DESTROYED || subtype == TYPE_GC_HANDLE_DESTROYED_BT) {
int has_bt = subtype == TYPE_GC_HANDLE_DESTROYED_BT;
int num_bt = 0;
if (debug)
fprintf (outfile, "handle (%s) %u destroyed\n", get_handle_name (htype), handle);
if (frames != sframes)
- free (frames);
+ g_free (frames);
} else if (subtype == TYPE_GC_FINALIZE_START) {
// TODO: Generate a finalizer report based on these events.
if (debug)
tracked_creation (OBJ_ADDR (objdiff), cd, len, bt, time_base);
}
if (frames != sframes)
- free (frames);
+ g_free (frames);
break;
}
case TYPE_METHOD: {
hs->roots_extra = thread->roots_extra;
hs->roots_types = thread->roots_types;
} else {
- free (thread->roots);
- free (thread->roots_extra);
- free (thread->roots_types);
+ g_free (thread->roots);
+ g_free (thread->roots_extra);
+ g_free (thread->roots_types);
}
thread->num_roots = 0;
thread->size_roots = 0;
if (debug)
fprintf (outfile, "monitor %s for object %p\n", monitor_ev_name (event), (void*)OBJ_ADDR (objdiff));
if (frames != sframes)
- free (frames);
+ g_free (frames);
break;
}
case TYPE_EXCEPTION: {
add_trace_thread (thread, &exc_traces, 1);
}
if (frames != sframes)
- free (frames);
+ g_free (frames);
if (debug)
fprintf (outfile, "throw %p\n", (void*)OBJ_ADDR (objdiff));
}
if (cd->root_references)
fprintf (outfile, "\t\t%zd root references (%zd pinning)\n", cd->root_references, cd->pinned_references);
dump_rev_claases (rev_sorted, cd->rev_count);
- free (rev_sorted);
+ g_free (rev_sorted);
}
- free (sorted);
+ g_free (sorted);
}
static int
*top++ = 0;
from_secs = atof (val);
to_secs = atof (top);
- free (val);
+ g_free (val);
if (from_secs > to_secs) {
usage ();
return 1;
sourceLoc = mono_debug_lookup_source_location (method, dmji->line_numbers[i].native_offset, mono_domain_get());
if (sourceLoc == NULL)
{
- free(vtuneMethod.line_number_table);
+ g_free (vtuneMethod.line_number_table);
vtuneMethod.line_number_table = NULL;
vtuneMethod.line_number_size = 0;
break;
iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, &vtuneMethod);
if (vtuneMethod.source_file_name != NULL)
- free(vtuneMethod.source_file_name);
+ g_free (vtuneMethod.source_file_name);
if (vtuneMethod.line_number_table != NULL)
- free(vtuneMethod.line_number_table);
+ g_free (vtuneMethod.line_number_table);
g_free (signature);
g_free (name);
if (runtime_inited)
mono_free (name);
else
- free (name);
+ g_free (name);
send_if_needed (prof);
if (runtime_inited)
mono_free (name);
else
- free (name);
+ g_free (name);
send_if_needed (prof);
add_code_page (n, size_code_pages, code_pages [i]);
}
if (code_pages)
- free (code_pages);
+ g_free (code_pages);
code_pages = n;
}
num_code_pages += add_code_page (code_pages, size_code_pages, ip & CPAGE_MASK);
filename = buf;
}
}
- obj = calloc (sizeof (BinaryObject), 1);
+ obj = g_calloc (sizeof (BinaryObject), 1);
obj->addr = (void*)info->dlpi_addr;
obj->name = pstrdup (filename);
obj->next = prof->binary_objects;
names = backtrace_symbols (&ip, 1);
if (names) {
const char* p = names [0];
- free (names);
+ g_free (names);
return p;
}
*/
int i, count = 0;
mmap_mask = num_pages * getpagesize () - 1;
num_perf = mono_cpu_count ();
- perf_data = calloc (num_perf, sizeof (PerfData));
+ perf_data = g_calloc (num_perf, sizeof (PerfData));
for (i = 0; i < num_perf; ++i) {
count += setup_perf_event_for_cpu (perf_data + i, i);
}
if (count)
return 1;
- free (perf_data);
+ g_free (perf_data);
perf_data = NULL;
return 0;
}
if (agent->counter == counter) {
agent->value_size = 0;
if (agent->value) {
- free (agent->value);
+ g_free (agent->value);
agent->value = NULL;
}
mono_os_mutex_unlock (&counters_mutex);
counters_emit (profiler);
buffer_size = 8;
- buffer = calloc (1, buffer_size);
+ buffer = g_calloc (1, buffer_size);
mono_os_mutex_lock (&counters_mutex);
continue; // FIXME error
} else if (size > buffer_size) {
buffer_size = size;
- buffer = realloc (buffer, buffer_size);
+ buffer = g_realloc (buffer, buffer_size);
}
memset (buffer, 0, buffer_size);
type = mono_counter_get_type (counter);
if (!agent->value) {
- agent->value = calloc (1, size);
+ agent->value = g_calloc (1, size);
agent->value_size = size;
} else {
if (type == MONO_COUNTER_STRING) {
}
if (type == MONO_COUNTER_STRING && size > agent->value_size) {
- agent->value = realloc (agent->value, size);
+ agent->value = g_realloc (agent->value, size);
agent->value_size = size;
}
if (size > 0)
memcpy (agent->value, buffer, size);
}
- free (buffer);
+ g_free (buffer);
emit_value (logbuffer, 0);
PROF_TLS_FREE ();
- free (prof->args);
- free (prof);
+ g_free (prof->args);
+ g_free (prof);
}
static char*
mono_free (name);
free_info:
- free (info);
+ g_free (info);
}
g_ptr_array_free (entry->methods, TRUE);
int s = strlen (nf) + 32;
char *p = (char *)malloc (s);
snprintf (p, s, "|mprof-report '--out=%s' -", nf);
- free (nf);
+ g_free (nf);
nf = p;
}
}
if (strcmp (val, "mono") == 0) {
do_mono_sample = 1;
sample_type = SAMPLE_CYCLES;
- free (val);
+ g_free (val);
return;
}
for (smode = sample_modes; smode->name; smode++) {
} else {
sample_freq = 100;
}
- free (val);
+ g_free (val);
}
static void
return;
if (strcmp (val, "ondemand") == 0) {
hs_mode_ondemand = 1;
- free (val);
+ g_free (val);
return;
}
count = strtoul (val, &end, 10);
hs_mode_gc = count;
else
usage (1);
- free (val);
+ g_free (val);
}
/*
fast_time = 2;
else
usage (1);
- free (val);
+ g_free (val);
continue;
}
if ((opt = match_option (p, "report", NULL)) != p) {
if ((opt = match_option (p, "port", &val)) != p) {
char *end;
command_port = strtoul (val, &end, 10);
- free (val);
+ g_free (val);
continue;
}
if ((opt = match_option (p, "maxframes", &val)) != p) {
num_frames = strtoul (val, &end, 10);
if (num_frames > MAX_FRAMES)
num_frames = MAX_FRAMES;
- free (val);
+ g_free (val);
notraces = num_frames == 0;
continue;
}
max_allocated_sample_hits = strtoul (val, &end, 10);
if (!max_allocated_sample_hits)
max_allocated_sample_hits = G_MAXINT32;
- free (val);
+ g_free (val);
continue;
}
if ((opt = match_option (p, "calldepth", &val)) != p) {
char *end;
max_call_depth = strtoul (val, &end, 10);
- free (val);
+ g_free (val);
continue;
}
if ((opt = match_option (p, "counters", NULL)) != p) {
#include <pthread.h>
#include <sched.h>
#endif
-
+#include <glib.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#ifdef HOST_WIN32
static int tls_data;
-#define DECL_TLS_DATA TlsData *tls; tls = (TlsData *) TlsGetValue (tls_data); if (tls == NULL) { tls = (TlsData *) calloc (sizeof (TlsData), 1); TlsSetValue (tls_data, tls); }
+#define DECL_TLS_DATA TlsData *tls; tls = (TlsData *) TlsGetValue (tls_data); if (tls == NULL) { tls = (TlsData *) g_calloc (sizeof (TlsData), 1); TlsSetValue (tls_data, tls); }
#define TLS_INIT(x) x = TlsAlloc()
#elif HAVE_KW_THREAD
static __thread TlsData tls_data;
#define TLS_INIT(x)
#else
static pthread_key_t tls_data;
-#define DECL_TLS_DATA TlsData *tls; tls = (TlsData *) pthread_getspecific (tls_data); if (tls == NULL) { tls = (TlsData *) calloc (sizeof (TlsData), 1); pthread_setspecific (tls_data, tls); }
+#define DECL_TLS_DATA TlsData *tls; tls = (TlsData *) pthread_getspecific (tls_data); if (tls == NULL) { tls = (TlsData *) g_calloc (sizeof (TlsData), 1); pthread_setspecific (tls_data, tls); }
#define TLS_INIT(x) pthread_key_create(&x, NULL)
#endif
los_num_objects--;
#ifdef USE_MALLOC
- free (obj);
+ g_free (obj);
#else
if (size > LOS_SECTION_OBJECT_LIMIT) {
int pagesize = mono_pagesize ();
sgen_ensure_free_space (size, GENERATION_OLD);
#ifdef USE_MALLOC
- obj = malloc (size + sizeof (LOSObject));
+ obj = g_malloc (size + sizeof (LOSObject));
memset (obj, 0, size + sizeof (LOSObject));
#else
if (size > LOS_SECTION_OBJECT_LIMIT) {
g_string_append_printf (bt, "\tat %s\n", names [i]);
}
- free (names);
+ g_free (names);
return g_string_free (bt, FALSE);
}
if (desc)
return desc;
- return calloc (1, sizeof (Descriptor));
+ return g_calloc (1, sizeof (Descriptor));
}
static void
dlfree (dead->data);
}
code_memory_used -= dead->size;
- free (dead);
+ g_free (dead);
}
}
{
free_chunklist (cman->full);
free_chunklist (cman->current);
- free (cman);
+ g_free (cman);
}
/**
#endif
}
- chunk = (CodeChunk *) malloc (sizeof (CodeChunk));
+ chunk = (CodeChunk *) g_malloc (sizeof (CodeChunk));
if (!chunk) {
if (flags == CODE_FLAG_MALLOC)
dlfree (ptr);
}
}
- counter = (MonoCounter *) malloc (sizeof (MonoCounter));
+ counter = (MonoCounter *) g_malloc (sizeof (MonoCounter));
if (!counter) {
mono_os_mutex_unlock (&counters_mutex);
return;
while (counter) {
MonoCounter *tmp = counter;
counter = counter->next;
- free ((void*)tmp->name);
- free (tmp);
+ g_free ((void*)tmp->name);
+ g_free (tmp);
}
mono_os_mutex_unlock (&counters_mutex);
if (error_msg)
*error_msg = NULL;
- module = (MonoDl *) malloc (sizeof (MonoDl));
+ module = (MonoDl *) g_malloc (sizeof (MonoDl));
if (!module) {
if (error_msg)
*error_msg = g_strdup ("Out of memory");
const char *ext;
/* This platform does not support dlopen */
if (name == NULL) {
- free (module);
+ g_free (module);
return NULL;
}
if (error_msg) {
*error_msg = mono_dl_current_error_string ();
}
- free (module);
+ g_free (module);
return NULL;
}
}
} else {
#if MONO_DL_NEED_USCORE
{
- char *usname = malloc (strlen (name) + 2);
+ char *usname = g_malloc (strlen (name) + 2);
*usname = '_';
strcpy (usname + 1, name);
sym = mono_dl_lookup_symbol (module, usname);
- free (usname);
+ g_free (usname);
}
#else
sym = mono_dl_lookup_symbol (module, name);
} else
mono_dl_close_handle (module);
- free (module);
+ g_free (module);
}
/**
void*
mono_valloc (void *addr, size_t length, int flags, MonoMemAccountType type)
{
- return malloc (length);
+ return g_malloc (length);
}
void*
int
mono_vfree (void *addr, size_t length, MonoMemAccountType type)
{
- free (addr);
+ g_free (addr);
return 0;
}
#ifdef KERN_PROC2
int mib [6];
size_t data_len = sizeof (struct kinfo_proc2) * 400;
- struct kinfo_proc2 *processes = malloc (data_len);
+ struct kinfo_proc2 *processes = g_malloc (data_len);
#else
int mib [4];
size_t data_len = sizeof (struct kinfo_proc) * 16;
res = sysctl (mib, 6, processes, &data_len, NULL, 0);
if (res < 0) {
- free (processes);
+ g_free (processes);
return NULL;
}
#else
res = sysctl (mib, 4, NULL, &data_len, NULL, 0);
if (res)
return NULL;
- processes = (struct kinfo_proc *) malloc (data_len);
+ processes = (struct kinfo_proc *) g_malloc (data_len);
res = sysctl (mib, 4, processes, &data_len, NULL, 0);
if (res < 0) {
- free (processes);
+ g_free (processes);
if (errno != ENOMEM)
return NULL;
limit --;
buf = (void **) g_realloc (buf, res * sizeof (void*));
for (i = 0; i < res; ++i)
buf [i] = GINT_TO_POINTER (processes [i].kinfo_pid_member);
- free (processes);
+ g_free (processes);
if (size)
*size = res;
return buf;
#if TEST
int main ()
{
- char *s = malloc (256);
+ char *s = g_malloc (256);
int i = 0;
s [255] = 0;