Use GstMemChunk to allocate events

Original commit message from CVS:
Use GstMemChunk to allocate events
This commit is contained in:
Wim Taymans 2003-05-10 12:15:58 +00:00
parent 76b9ffbdbc
commit b41c935ff7

View file

@ -24,6 +24,7 @@
#include "gstinfo.h" #include "gstinfo.h"
#include "gstdata_private.h" #include "gstdata_private.h"
#include "gstmemchunk.h"
#include "gstevent.h" #include "gstevent.h"
#include "gstlog.h" #include "gstlog.h"
@ -33,6 +34,8 @@
static GstAllocTrace *_event_trace; static GstAllocTrace *_event_trace;
#endif #endif
static GstMemChunk *chunk;
/* #define MEMPROF */ /* #define MEMPROF */
GType _gst_event_type; GType _gst_event_type;
@ -48,6 +51,9 @@ _gst_event_initialize (void)
#ifndef GST_DISABLE_TRACE #ifndef GST_DISABLE_TRACE
_event_trace = gst_alloc_trace_register (GST_EVENT_TRACE_NAME); _event_trace = gst_alloc_trace_register (GST_EVENT_TRACE_NAME);
#endif #endif
chunk = gst_mem_chunk_new ("GstEventChunk", sizeof (GstEvent),
sizeof (GstEvent) * 50, 0);
} }
static GstEvent* static GstEvent*
@ -55,7 +61,7 @@ _gst_event_copy (GstEvent *event)
{ {
GstEvent *copy; GstEvent *copy;
copy = g_new0(GstEvent, 1); copy = gst_mem_chunk_alloc (chunk);
#ifndef GST_DISABLE_TRACE #ifndef GST_DISABLE_TRACE
gst_alloc_trace_new (_event_trace, copy); gst_alloc_trace_new (_event_trace, copy);
#endif #endif
@ -83,8 +89,7 @@ _gst_event_free (GstEvent* event)
#ifndef GST_DISABLE_TRACE #ifndef GST_DISABLE_TRACE
gst_alloc_trace_free (_event_trace, event); gst_alloc_trace_free (_event_trace, event);
#endif #endif
gst_mem_chunk_free (chunk, event);
g_free (event);
} }
/** /**
@ -134,7 +139,7 @@ gst_event_new (GstEventType type)
{ {
GstEvent *event; GstEvent *event;
event = g_new0(GstEvent, 1); event = gst_mem_chunk_alloc0 (chunk);
#ifndef GST_DISABLE_TRACE #ifndef GST_DISABLE_TRACE
gst_alloc_trace_new (_event_trace, event); gst_alloc_trace_new (_event_trace, event);
#endif #endif