glbasememory: Free the actual memory object when requested

Otherwise we are leaking ~400B on each GstMemory allocation.

Freeing in the base class matches the GObject semantics.
This commit is contained in:
Matthew Waters 2016-01-07 20:56:54 +11:00
parent 3423e108d4
commit 04ec728722
2 changed files with 3 additions and 8 deletions

View file

@ -442,6 +442,8 @@ _mem_free (GstAllocator * allocator, GstMemory * memory)
mem->notify (mem->user_data); mem->notify (mem->user_data);
gst_object_unref (mem->context); gst_object_unref (mem->context);
g_free (memory);
} }
/** /**

View file

@ -236,7 +236,7 @@ _gl_mem_new (GstAllocator * allocator, GstMemory * parent,
GDestroyNotify notify) GDestroyNotify notify)
{ {
GstGLMemoryPBO *mem; GstGLMemoryPBO *mem;
mem = g_slice_new0 (GstGLMemoryPBO); mem = g_new0 (GstGLMemoryPBO, 1);
mem->mem.texture_wrapped = FALSE; mem->mem.texture_wrapped = FALSE;
_gl_mem_init (mem, allocator, parent, context, target, params, info, plane, _gl_mem_init (mem, allocator, parent, context, target, params, info, plane,
@ -657,12 +657,6 @@ _gl_mem_destroy (GstGLMemoryPBO * gl_mem)
*) gl_mem); *) gl_mem);
} }
static void
_gl_mem_free (GstAllocator * allocator, GstMemory * mem)
{
GST_ALLOCATOR_CLASS (parent_class)->free (allocator, mem);
}
static GstGLMemoryPBO * static GstGLMemoryPBO *
_gl_mem_pbo_alloc (GstGLBaseMemoryAllocator * allocator, _gl_mem_pbo_alloc (GstGLBaseMemoryAllocator * allocator,
GstGLVideoAllocationParams * params) GstGLVideoAllocationParams * params)
@ -722,7 +716,6 @@ gst_gl_memory_pbo_allocator_class_init (GstGLMemoryPBOAllocatorClass * klass)
gl_base->destroy = (GstGLBaseMemoryAllocatorDestroyFunction) _gl_mem_destroy; gl_base->destroy = (GstGLBaseMemoryAllocatorDestroyFunction) _gl_mem_destroy;
allocator_class->alloc = _gl_mem_alloc; allocator_class->alloc = _gl_mem_alloc;
allocator_class->free = _gl_mem_free;
} }
static void static void