mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-capture: Use malloc() rather than g_new0() and friends
Another step away from GLib. This changes the OOM behaviour of the library — previously it would immediately `abort()` on OOM. However, it seems likely that given the small number of allocations libsysprof-capture does, it should be able to recover from an OOM situation more gracefully than larger libraries can — so the new implementation tries to do that. Signed-off-by: Philip Withnall <withnall@endlessm.com> Helps: #40
This commit is contained in:
@ -63,6 +63,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "sysprof-capture-condition.h"
|
||||
#include "sysprof-capture-util-private.h"
|
||||
#include "sysprof-macros-internal.h"
|
||||
|
||||
/**
|
||||
@ -204,7 +205,10 @@ sysprof_capture_condition_init (void)
|
||||
{
|
||||
SysprofCaptureCondition *self;
|
||||
|
||||
self = g_slice_new0 (SysprofCaptureCondition);
|
||||
self = sysprof_malloc0 (sizeof (SysprofCaptureCondition));
|
||||
if (self == NULL)
|
||||
return NULL;
|
||||
|
||||
self->ref_count = 1;
|
||||
|
||||
return g_steal_pointer (&self);
|
||||
@ -294,7 +298,7 @@ sysprof_capture_condition_finalize (SysprofCaptureCondition *self)
|
||||
break;
|
||||
}
|
||||
|
||||
g_slice_free (SysprofCaptureCondition, self);
|
||||
free (self);
|
||||
}
|
||||
|
||||
SysprofCaptureCondition *
|
||||
|
||||
Reference in New Issue
Block a user