mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-07 16:05:47 +00:00
More testcases
Original commit message from CVS: More testcases
This commit is contained in:
parent
b42e262efe
commit
1041fcea08
8 changed files with 538 additions and 336 deletions
|
@ -1,104 +1,98 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
#define ITERS 100000
|
#define ITERS 100000
|
||||||
|
#include <stdlib.h>
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
|
|
||||||
static void
|
|
||||||
print_element_props (GstElement *element)
|
|
||||||
{
|
|
||||||
g_print ("name %s\n", gst_element_get_name (element));
|
|
||||||
g_print ("flags 0x%08x\n", GST_FLAGS (element));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, gchar *argv[])
|
main (int argc, gchar *argv[])
|
||||||
{
|
{
|
||||||
GstElement *element;
|
GstElement *element;
|
||||||
long usage1, usage2;
|
long usage1;
|
||||||
gint i;
|
gint i, iters;
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
gst_init (&argc, &argv);
|
||||||
|
|
||||||
g_print ("creating new element\n");
|
if (argc == 2)
|
||||||
element = gst_element_new ();
|
iters = atoi (argv[1]);
|
||||||
usage1 = vmsize();
|
else
|
||||||
print_element_props (element);
|
iters = ITERS;
|
||||||
g_print ("unref new element %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (element));
|
g_print ("starting test\n");
|
||||||
|
usage1 = vmsize();
|
||||||
|
|
||||||
|
element = gst_element_new ();
|
||||||
|
gst_object_unref (GST_OBJECT (element));
|
||||||
|
g_print ("create/unref new element %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
|
for (i=0; i<iters;i++) {
|
||||||
|
element = gst_element_new ();
|
||||||
|
gst_object_unref (GST_OBJECT (element));
|
||||||
|
}
|
||||||
|
g_print ("create/unref %d elements %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("creating new element\n");
|
|
||||||
element = gst_element_new ();
|
element = gst_element_new ();
|
||||||
g_assert (GST_OBJECT_FLOATING (element));
|
g_assert (GST_OBJECT_FLOATING (element));
|
||||||
print_element_props (element);
|
|
||||||
g_print ("sink new element %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_ref (GST_OBJECT (element));
|
gst_object_ref (GST_OBJECT (element));
|
||||||
gst_object_sink (GST_OBJECT (element));
|
gst_object_sink (GST_OBJECT (element));
|
||||||
g_assert (!GST_OBJECT_FLOATING (element));
|
g_assert (!GST_OBJECT_FLOATING (element));
|
||||||
print_element_props (element);
|
|
||||||
g_print ("unref new element %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
|
g_print ("create/ref/sink/unref new element %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
|
||||||
|
for (i=0; i<iters;i++) {
|
||||||
element = gst_element_new ();
|
element = gst_element_new ();
|
||||||
|
gst_object_ref (GST_OBJECT (element));
|
||||||
|
gst_object_sink (GST_OBJECT (element));
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
}
|
}
|
||||||
g_print ("unref 100000 element %ld\n", vmsize()-usage1);
|
g_print ("create/ref/sink/unref %d elements %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("creating new element\n");
|
|
||||||
element = gst_element_new ();
|
element = gst_element_new ();
|
||||||
g_assert (!GST_OBJECT_DESTROYED (element));
|
g_assert (!GST_OBJECT_DESTROYED (element));
|
||||||
print_element_props (element);
|
|
||||||
g_print ("destroy new element %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_destroy (GST_OBJECT (element));
|
gst_object_destroy (GST_OBJECT (element));
|
||||||
g_assert (GST_OBJECT_DESTROYED (element));
|
g_assert (GST_OBJECT_DESTROYED (element));
|
||||||
print_element_props (element);
|
|
||||||
g_print ("unref new element %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
|
g_print ("create/destroy/unref new element %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
element = gst_element_new ();
|
element = gst_element_new ();
|
||||||
gst_object_destroy (GST_OBJECT (element));
|
gst_object_destroy (GST_OBJECT (element));
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 element %ld\n", vmsize()-usage1);
|
g_print ("create/destroy/unref %d element %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("creating new element\n");
|
|
||||||
element = gst_element_new ();
|
element = gst_element_new ();
|
||||||
gst_object_ref (GST_OBJECT (element));
|
gst_object_ref (GST_OBJECT (element));
|
||||||
print_element_props (element);
|
|
||||||
g_print ("unref new element %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
g_print ("unref new element %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
|
g_print ("create/ref/unref/unref new element %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
element = gst_element_new ();
|
element = gst_element_new ();
|
||||||
gst_object_ref (GST_OBJECT (element));
|
gst_object_ref (GST_OBJECT (element));
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 element %ld\n", vmsize()-usage1);
|
g_print ("create/ref/unref/unref %d element %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("creating new element\n");
|
|
||||||
element = gst_element_new ();
|
element = gst_element_new ();
|
||||||
gst_object_ref (GST_OBJECT (element));
|
gst_object_ref (GST_OBJECT (element));
|
||||||
print_element_props (element);
|
|
||||||
gst_object_destroy (GST_OBJECT (element));
|
gst_object_destroy (GST_OBJECT (element));
|
||||||
g_print ("unref new element %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
g_print ("unref new element %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
|
g_print ("craete/ref/destroy/unref/unref new element %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
element = gst_element_new ();
|
element = gst_element_new ();
|
||||||
gst_object_ref (GST_OBJECT (element));
|
gst_object_ref (GST_OBJECT (element));
|
||||||
gst_object_destroy (GST_OBJECT (element));
|
gst_object_destroy (GST_OBJECT (element));
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 element %ld\n", vmsize()-usage1);
|
g_print ("craete/ref/destroy/unref/unref %d elements %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
element = gst_element_new ();
|
element = gst_element_new ();
|
||||||
gst_object_ref (GST_OBJECT (element));
|
gst_object_ref (GST_OBJECT (element));
|
||||||
gst_element_set_name (element, "testing123");
|
gst_element_set_name (element, "testing123");
|
||||||
|
@ -107,16 +101,16 @@ main (int argc, gchar *argv[])
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 element %ld\n", vmsize()-usage1);
|
g_print ("craete/ref/destroy/unref/unref %d elements with name %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
element = gst_element_new ();
|
element = gst_element_new ();
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
gst_element_set_name (element, "testing");
|
gst_element_set_name (element, "testing");
|
||||||
}
|
}
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
g_print ("destroy/unref 100000 element %ld\n", vmsize()-usage1);
|
g_print ("set name %d times %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("leaked: %ld\n", vmsize()-usage1);
|
g_print ("leaked: %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
return 0;
|
return (vmsize()-usage1 ? -1 : 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,9 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
#define ITERS 100000
|
#define ITERS 100000
|
||||||
|
#include <stdlib.h>
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
|
|
||||||
static void
|
|
||||||
print_pad_props (GstPad *pad)
|
|
||||||
{
|
|
||||||
g_print ("name %s\n", gst_pad_get_name (pad));
|
|
||||||
g_print ("flags 0x%08x\n", GST_FLAGS (pad));
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstElement*
|
static GstElement*
|
||||||
create_element (gchar *padname, GstPadDirection dir)
|
create_element (gchar *padname, GstPadDirection dir)
|
||||||
{
|
{
|
||||||
|
@ -30,29 +24,34 @@ main (int argc, gchar *argv[])
|
||||||
GstElement *element2;
|
GstElement *element2;
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
long usage1;
|
long usage1;
|
||||||
gint i;
|
gint i, iters;
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
gst_init (&argc, &argv);
|
||||||
|
|
||||||
g_print ("creating new element\n");
|
if (argc == 2)
|
||||||
element = gst_element_new ();
|
iters = atoi (argv[1]);
|
||||||
|
else
|
||||||
|
iters = ITERS;
|
||||||
|
|
||||||
|
|
||||||
|
g_print ("starting element with pad test with %d iterations\n", iters);
|
||||||
usage1 = vmsize();
|
usage1 = vmsize();
|
||||||
|
|
||||||
pad = gst_pad_new ("sink", GST_PAD_SINK);
|
element = create_element ("sink", GST_PAD_SINK);
|
||||||
print_pad_props (pad);
|
pad = gst_element_get_pad (element, "sink");
|
||||||
gst_element_add_pad (element, pad);
|
g_assert (GST_OBJECT_FLOATING (element));
|
||||||
print_pad_props (pad);
|
g_assert (!GST_OBJECT_FLOATING (pad));
|
||||||
|
g_assert (gst_pad_get_parent (pad) == element);
|
||||||
g_print ("unref new element %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
|
g_print ("create/addpad/unref new element %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS; i++) {
|
for (i=0; i<iters; i++) {
|
||||||
element = create_element ("sink", GST_PAD_SINK);
|
element = create_element ("sink", GST_PAD_SINK);
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 element %ld\n", vmsize()-usage1);
|
g_print ("create/addpad/unref %d elements %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS/2; i++) {
|
for (i=0; i<iters/2; i++) {
|
||||||
element = create_element ("sink", GST_PAD_SINK);
|
element = create_element ("sink", GST_PAD_SINK);
|
||||||
element2 = create_element ("src", GST_PAD_SRC);
|
element2 = create_element ("src", GST_PAD_SRC);
|
||||||
gst_element_connect (element, "sink", element2, "src");
|
gst_element_connect (element, "sink", element2, "src");
|
||||||
|
@ -62,9 +61,9 @@ main (int argc, gchar *argv[])
|
||||||
g_assert (!GST_PAD_CONNECTED (gst_element_get_pad (element2, "src")));
|
g_assert (!GST_PAD_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||||
gst_object_unref (GST_OBJECT (element2));
|
gst_object_unref (GST_OBJECT (element2));
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 element %ld\n", vmsize()-usage1);
|
g_print ("create/connect/unref %d elements %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("leaked: %ld\n", vmsize()-usage1);
|
g_print ("leaked: %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
return 0;
|
return (vmsize()-usage1 ? -1 : 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,104 +1,97 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
#define ITERS 100000
|
#define ITERS 100000
|
||||||
|
#include <stdlib.h>
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
|
|
||||||
static void
|
|
||||||
print_object_props (GstObject *object)
|
|
||||||
{
|
|
||||||
g_print ("name %s\n", gst_object_get_name (object));
|
|
||||||
g_print ("flags 0x%08lx\n", GST_FLAGS (object));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, gchar *argv[])
|
main (int argc, gchar *argv[])
|
||||||
{
|
{
|
||||||
GstObject *object;
|
GstObject *object, *object2;
|
||||||
long usage1, usage2;
|
long usage1;
|
||||||
gint i;
|
gint i, iters;
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
gst_init (&argc, &argv);
|
||||||
|
|
||||||
g_print ("creating new object\n");
|
if (argc == 2)
|
||||||
object = gst_object_new ();
|
iters = atoi (argv[1]);
|
||||||
|
else
|
||||||
|
iters = ITERS;
|
||||||
|
|
||||||
|
g_print ("starting test with %d iterations\n", iters);
|
||||||
usage1 = vmsize();
|
usage1 = vmsize();
|
||||||
print_object_props (object);
|
object = gst_object_new ();
|
||||||
g_print ("unref new object %ld\n", vmsize()-usage1);
|
gst_object_unref (object);
|
||||||
|
g_print ("create/unref new object %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
|
for (i=0; i<iters;i++) {
|
||||||
|
object = gst_object_new ();
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
|
|
||||||
g_print ("creating new object\n");
|
}
|
||||||
|
g_print ("create/unref %d object %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
object = gst_object_new ();
|
object = gst_object_new ();
|
||||||
g_assert (GST_OBJECT_FLOATING (object));
|
g_assert (GST_OBJECT_FLOATING (object));
|
||||||
print_object_props (object);
|
|
||||||
g_print ("sink new object %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_ref (object);
|
gst_object_ref (object);
|
||||||
gst_object_sink (object);
|
gst_object_sink (object);
|
||||||
g_assert (!GST_OBJECT_FLOATING (object));
|
g_assert (!GST_OBJECT_FLOATING (object));
|
||||||
print_object_props (object);
|
|
||||||
g_print ("unref new object %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
|
g_print ("create/ref/sink/unref new object %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
object = gst_object_new ();
|
object = gst_object_new ();
|
||||||
|
gst_object_ref (object);
|
||||||
|
gst_object_sink (object);
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
}
|
}
|
||||||
g_print ("unref 100000 object %ld\n", vmsize()-usage1);
|
g_print ("create/ref/sink/unref %d object %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("creating new object\n");
|
|
||||||
object = gst_object_new ();
|
object = gst_object_new ();
|
||||||
g_assert (!GST_OBJECT_DESTROYED (object));
|
g_assert (!GST_OBJECT_DESTROYED (object));
|
||||||
print_object_props (object);
|
|
||||||
g_print ("destroy new object %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_destroy (object);
|
gst_object_destroy (object);
|
||||||
g_assert (GST_OBJECT_DESTROYED (object));
|
g_assert (GST_OBJECT_DESTROYED (object));
|
||||||
print_object_props (object);
|
|
||||||
g_print ("unref new object %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
|
g_print ("create/destroy/unref new object %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
object = gst_object_new ();
|
object = gst_object_new ();
|
||||||
gst_object_destroy (object);
|
gst_object_destroy (object);
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 object %ld\n", vmsize()-usage1);
|
g_print ("destroy/unref %d object %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("creating new object\n");
|
|
||||||
object = gst_object_new ();
|
object = gst_object_new ();
|
||||||
gst_object_ref (object);
|
gst_object_ref (object);
|
||||||
print_object_props (object);
|
|
||||||
g_print ("unref new object %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
g_print ("unref new object %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
|
g_print ("create/ref/unref/unref new object %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
object = gst_object_new ();
|
object = gst_object_new ();
|
||||||
gst_object_ref (object);
|
gst_object_ref (object);
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 object %ld\n", vmsize()-usage1);
|
g_print ("create/ref/unref/unref %d object %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("creating new object\n");
|
|
||||||
object = gst_object_new ();
|
object = gst_object_new ();
|
||||||
gst_object_ref (object);
|
gst_object_ref (object);
|
||||||
print_object_props (object);
|
|
||||||
gst_object_destroy (object);
|
gst_object_destroy (object);
|
||||||
g_print ("unref new object %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
g_print ("unref new object %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
|
g_print ("create/ref/destroy/unref/unref new object %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
object = gst_object_new ();
|
object = gst_object_new ();
|
||||||
gst_object_ref (object);
|
gst_object_ref (object);
|
||||||
gst_object_destroy (object);
|
gst_object_destroy (object);
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 object %ld\n", vmsize()-usage1);
|
g_print ("create/ref/destroy/unref/unref %d object %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
object = gst_object_new ();
|
object = gst_object_new ();
|
||||||
gst_object_ref (object);
|
gst_object_ref (object);
|
||||||
gst_object_set_name (object, "testing123");
|
gst_object_set_name (object, "testing123");
|
||||||
|
@ -107,16 +100,57 @@ main (int argc, gchar *argv[])
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 object %ld\n", vmsize()-usage1);
|
g_print ("create/ref/destroy/unref/unref %d object with name %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
object = gst_object_new ();
|
object = gst_object_new ();
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
gst_object_set_name (object, "testing");
|
gst_object_set_name (object, "testing");
|
||||||
}
|
}
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
g_print ("destroy/unref 100000 object %ld\n", vmsize()-usage1);
|
g_print ("create/set name/unref %d object %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
|
object = gst_object_new ();
|
||||||
|
object2 = gst_object_new ();
|
||||||
|
g_assert (GST_OBJECT_FLOATING (object));
|
||||||
|
g_assert (GST_OBJECT_FLOATING (object2));
|
||||||
|
|
||||||
|
gst_object_set_parent (object, object2);
|
||||||
|
g_assert (GST_OBJECT_FLOATING (object2));
|
||||||
|
g_assert (!GST_OBJECT_FLOATING (object));
|
||||||
|
|
||||||
|
g_print ("parentage flags set_parent ok %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
|
gst_object_ref (object);
|
||||||
|
gst_object_unparent (object);
|
||||||
|
g_assert (GST_OBJECT_FLOATING (object2));
|
||||||
|
g_assert (!GST_OBJECT_FLOATING (object));
|
||||||
|
g_assert (gst_object_get_parent (object) == NULL);
|
||||||
|
|
||||||
|
g_print ("parentage flags unparent ok %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
|
gst_object_set_parent (object, object2);
|
||||||
|
g_assert (GST_OBJECT_FLOATING (object2));
|
||||||
|
g_assert (!GST_OBJECT_FLOATING (object));
|
||||||
|
g_assert (gst_object_get_parent (object) == object2);
|
||||||
|
|
||||||
|
gst_object_destroy (object);
|
||||||
|
g_assert (GST_OBJECT_DESTROYED (object));
|
||||||
|
g_assert (!GST_OBJECT_FLOATING (object));
|
||||||
|
g_assert (gst_object_get_parent (object) == NULL);
|
||||||
|
gst_object_unref (object);
|
||||||
|
|
||||||
|
g_print ("parentage flags destroy ok %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
|
for (i=0; i<iters;i++) {
|
||||||
|
object = gst_object_new ();
|
||||||
|
object2 = gst_object_new ();
|
||||||
|
gst_object_set_parent (object2, object);
|
||||||
|
gst_object_unref (object);
|
||||||
|
gst_object_unref (object2);
|
||||||
|
}
|
||||||
|
g_print ("create/unref %d 2 parented objects %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("leaked: %ld\n", vmsize()-usage1);
|
g_print ("leaked: %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
return 0;
|
return (vmsize()-usage1 ? -1 : 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,9 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
#define ITERS 100000
|
#define ITERS 100000
|
||||||
|
#include <stdlib.h>
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
|
|
||||||
static void
|
|
||||||
print_pad_props (GstPad *pad)
|
|
||||||
{
|
|
||||||
g_print ("name %s\n", gst_pad_get_name (pad));
|
|
||||||
g_print ("flags 0x%08x\n", GST_FLAGS (pad));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, gchar *argv[])
|
main (int argc, gchar *argv[])
|
||||||
{
|
{
|
||||||
|
@ -17,90 +11,89 @@ main (int argc, gchar *argv[])
|
||||||
GstPad *pad2;
|
GstPad *pad2;
|
||||||
GstPadTemplate *padtempl;
|
GstPadTemplate *padtempl;
|
||||||
long usage1;
|
long usage1;
|
||||||
gint i;
|
gint i, iters;
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
gst_init (&argc, &argv);
|
||||||
|
|
||||||
g_print ("creating new pad\n");
|
if (argc == 2)
|
||||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
iters = atoi (argv[1]);
|
||||||
usage1 = vmsize();
|
else
|
||||||
print_pad_props (pad);
|
iters = ITERS;
|
||||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
g_print ("starting pad test\n");
|
||||||
|
usage1 = vmsize();
|
||||||
|
|
||||||
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
g_print ("create/unref new pad %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
|
for (i=0; i<iters;i++) {
|
||||||
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
}
|
||||||
|
g_print ("create/unref %d pads %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("creating new pad\n");
|
|
||||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
g_assert (GST_OBJECT_FLOATING (pad));
|
g_assert (GST_OBJECT_FLOATING (pad));
|
||||||
print_pad_props (pad);
|
|
||||||
g_print ("sink new pad %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_ref (GST_OBJECT (pad));
|
gst_object_ref (GST_OBJECT (pad));
|
||||||
gst_object_sink (GST_OBJECT (pad));
|
gst_object_sink (GST_OBJECT (pad));
|
||||||
g_assert (!GST_OBJECT_FLOATING (pad));
|
g_assert (!GST_OBJECT_FLOATING (pad));
|
||||||
print_pad_props (pad);
|
|
||||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
g_print ("create/ref/sink/unref new pad %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
|
gst_object_ref (GST_OBJECT (pad));
|
||||||
|
gst_object_sink (GST_OBJECT (pad));
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
}
|
}
|
||||||
g_print ("unref 100000 pad %ld\n", vmsize()-usage1);
|
g_print ("create/ref/sink/unref %d pads %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("creating new pad\n");
|
|
||||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
g_assert (!GST_OBJECT_DESTROYED (pad));
|
g_assert (!GST_OBJECT_DESTROYED (pad));
|
||||||
print_pad_props (pad);
|
|
||||||
g_print ("destroy new pad %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_destroy (GST_OBJECT (pad));
|
gst_object_destroy (GST_OBJECT (pad));
|
||||||
g_assert (GST_OBJECT_DESTROYED (pad));
|
g_assert (GST_OBJECT_DESTROYED (pad));
|
||||||
print_pad_props (pad);
|
|
||||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
g_print ("create/destroy/unref pad %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
gst_object_destroy (GST_OBJECT (pad));
|
gst_object_destroy (GST_OBJECT (pad));
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 pad %ld\n", vmsize()-usage1);
|
g_print ("create/destroy/unref %d pads %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("creating new pad\n");
|
|
||||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
gst_object_ref (GST_OBJECT (pad));
|
gst_object_ref (GST_OBJECT (pad));
|
||||||
print_pad_props (pad);
|
|
||||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
g_print ("create/ref/unref/unref pad %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
gst_object_ref (GST_OBJECT (pad));
|
gst_object_ref (GST_OBJECT (pad));
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 pad %ld\n", vmsize()-usage1);
|
g_print ("create/ref/unref/unref %d pads %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("creating new pad\n");
|
|
||||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
gst_object_ref (GST_OBJECT (pad));
|
gst_object_ref (GST_OBJECT (pad));
|
||||||
print_pad_props (pad);
|
|
||||||
gst_object_destroy (GST_OBJECT (pad));
|
gst_object_destroy (GST_OBJECT (pad));
|
||||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
g_print ("create/ref/destroy/unref/unref pad %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
gst_object_ref (GST_OBJECT (pad));
|
gst_object_ref (GST_OBJECT (pad));
|
||||||
gst_object_destroy (GST_OBJECT (pad));
|
gst_object_destroy (GST_OBJECT (pad));
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 pad %ld\n", vmsize()-usage1);
|
g_print ("create/ref/destroy/unref/unref %d pads %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
gst_object_ref (GST_OBJECT (pad));
|
gst_object_ref (GST_OBJECT (pad));
|
||||||
gst_pad_set_name (pad, "testing123");
|
gst_pad_set_name (pad, "testing123");
|
||||||
|
@ -109,41 +102,122 @@ main (int argc, gchar *argv[])
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 pad %ld\n", vmsize()-usage1);
|
g_print ("create/ref/destroy/unref/unref %d pads %ld with name\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
gst_pad_set_name (pad, "testing");
|
gst_pad_set_name (pad, "testing");
|
||||||
}
|
}
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
g_print ("destroy/unref 100000 pad %ld\n", vmsize()-usage1);
|
g_print ("set name %d times %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("connecting pad %ld\n", vmsize()-usage1);
|
|
||||||
|
|
||||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||||
|
|
||||||
|
gst_pad_connect (pad2, pad);
|
||||||
|
g_assert (GST_PAD_CONNECTED (pad));
|
||||||
|
g_assert (GST_PAD_CONNECTED (pad2));
|
||||||
|
gst_pad_disconnect (pad2, pad);
|
||||||
|
g_assert (!GST_PAD_CONNECTED (pad));
|
||||||
|
g_assert (!GST_PAD_CONNECTED (pad2));
|
||||||
|
g_print ("connect/disconnect pad %ld\n", vmsize()-usage1);
|
||||||
gst_pad_connect (pad, pad2);
|
gst_pad_connect (pad, pad2);
|
||||||
|
g_assert (GST_PAD_CONNECTED (pad));
|
||||||
|
g_assert (GST_PAD_CONNECTED (pad2));
|
||||||
gst_pad_disconnect (pad, pad2);
|
gst_pad_disconnect (pad, pad2);
|
||||||
|
g_assert (!GST_PAD_CONNECTED (pad));
|
||||||
|
g_assert (!GST_PAD_CONNECTED (pad2));
|
||||||
|
g_print ("connect/disconnect pad wrong direction %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
gst_object_unref (GST_OBJECT (pad2));
|
||||||
|
|
||||||
|
for (i=0; i<iters;i++) {
|
||||||
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
|
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||||
gst_pad_connect (pad2, pad);
|
gst_pad_connect (pad2, pad);
|
||||||
gst_pad_disconnect (pad2, pad);
|
gst_pad_disconnect (pad2, pad);
|
||||||
|
gst_pad_connect (pad, pad2);
|
||||||
|
gst_pad_disconnect (pad, pad2);
|
||||||
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
gst_object_unref (GST_OBJECT (pad2));
|
||||||
|
}
|
||||||
|
g_print ("connect/disconnect %d pads %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("padtemplates create/destroy %ld\n", vmsize()-usage1);
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
|
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
gst_pad_connect (pad2, pad);
|
||||||
|
g_assert (GST_PAD_CONNECTED (pad2));
|
||||||
|
g_assert (GST_PAD_CONNECTED (pad));
|
||||||
|
|
||||||
|
gst_object_unref (GST_OBJECT (pad2));
|
||||||
|
g_assert (!GST_PAD_CONNECTED (pad));
|
||||||
|
g_assert (!GST_OBJECT_DESTROYED (pad));
|
||||||
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
|
||||||
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
|
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||||
|
|
||||||
|
gst_pad_connect (pad2, pad);
|
||||||
|
g_assert (GST_PAD_CONNECTED (pad2));
|
||||||
|
g_assert (GST_PAD_CONNECTED (pad));
|
||||||
|
|
||||||
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
g_assert (!GST_PAD_CONNECTED (pad2));
|
||||||
|
g_assert (!GST_OBJECT_DESTROYED (pad2));
|
||||||
|
gst_object_unref (GST_OBJECT (pad2));
|
||||||
|
|
||||||
|
g_print ("pad unref effects on connect pad ok %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
|
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||||
|
|
||||||
|
gst_pad_connect (pad2, pad);
|
||||||
|
g_assert (GST_PAD_CONNECTED (pad2));
|
||||||
|
g_assert (GST_PAD_CONNECTED (pad));
|
||||||
|
|
||||||
|
gst_object_destroy (GST_OBJECT (pad2));
|
||||||
|
g_assert (GST_OBJECT_DESTROYED (pad2));
|
||||||
|
g_assert (!GST_OBJECT_DESTROYED (pad));
|
||||||
|
g_assert (!GST_PAD_CONNECTED (pad));
|
||||||
|
gst_object_unref (GST_OBJECT (pad2));
|
||||||
|
g_assert (!GST_OBJECT_DESTROYED (pad));
|
||||||
|
g_assert (!GST_PAD_CONNECTED (pad));
|
||||||
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
|
||||||
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
|
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||||
|
|
||||||
|
gst_pad_connect (pad2, pad);
|
||||||
|
g_assert (GST_PAD_CONNECTED (pad2));
|
||||||
|
g_assert (GST_PAD_CONNECTED (pad));
|
||||||
|
|
||||||
|
gst_object_destroy (GST_OBJECT (pad));
|
||||||
|
g_assert (GST_OBJECT_DESTROYED (pad));
|
||||||
|
g_assert (!GST_OBJECT_DESTROYED (pad2));
|
||||||
|
g_assert (!GST_PAD_CONNECTED (pad2));
|
||||||
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
g_assert (!GST_OBJECT_DESTROYED (pad2));
|
||||||
|
g_assert (!GST_PAD_CONNECTED (pad2));
|
||||||
|
gst_object_unref (GST_OBJECT (pad2));
|
||||||
|
|
||||||
|
g_print ("pad destroy effects on connect pad ok %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
|
for (i=0; i<iters;i++) {
|
||||||
padtempl = gst_padtemplate_new ("sink%d", GST_PAD_SINK, GST_PAD_SOMETIMES, NULL);
|
padtempl = gst_padtemplate_new ("sink%d", GST_PAD_SINK, GST_PAD_SOMETIMES, NULL);
|
||||||
gst_object_unref (GST_OBJECT (padtempl));
|
gst_object_unref (GST_OBJECT (padtempl));
|
||||||
}
|
}
|
||||||
|
g_print ("%d padtemplates create/unref %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("padtemplates create/destroy on pad %ld\n", vmsize()-usage1);
|
for (i=0; i<iters;i++) {
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
|
||||||
padtempl = gst_padtemplate_new ("sink%d", GST_PAD_SINK, GST_PAD_SOMETIMES, NULL);
|
padtempl = gst_padtemplate_new ("sink%d", GST_PAD_SINK, GST_PAD_SOMETIMES, NULL);
|
||||||
pad = gst_pad_new_from_template (padtempl, "sink1");
|
pad = gst_pad_new_from_template (padtempl, "sink1");
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
}
|
}
|
||||||
|
g_print ("%d pads create/unref from padtemplate %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("leaked: %ld\n", vmsize()-usage1);
|
g_print ("leaked: %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
return 0;
|
return vmsize()-usage1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,104 +1,98 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
#define ITERS 100000
|
#define ITERS 100000
|
||||||
|
#include <stdlib.h>
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
|
|
||||||
static void
|
|
||||||
print_element_props (GstElement *element)
|
|
||||||
{
|
|
||||||
g_print ("name %s\n", gst_element_get_name (element));
|
|
||||||
g_print ("flags 0x%08x\n", GST_FLAGS (element));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, gchar *argv[])
|
main (int argc, gchar *argv[])
|
||||||
{
|
{
|
||||||
GstElement *element;
|
GstElement *element;
|
||||||
long usage1, usage2;
|
long usage1;
|
||||||
gint i;
|
gint i, iters;
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
gst_init (&argc, &argv);
|
||||||
|
|
||||||
g_print ("creating new element\n");
|
if (argc == 2)
|
||||||
element = gst_element_new ();
|
iters = atoi (argv[1]);
|
||||||
usage1 = vmsize();
|
else
|
||||||
print_element_props (element);
|
iters = ITERS;
|
||||||
g_print ("unref new element %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (element));
|
g_print ("starting test\n");
|
||||||
|
usage1 = vmsize();
|
||||||
|
|
||||||
|
element = gst_element_new ();
|
||||||
|
gst_object_unref (GST_OBJECT (element));
|
||||||
|
g_print ("create/unref new element %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
|
for (i=0; i<iters;i++) {
|
||||||
|
element = gst_element_new ();
|
||||||
|
gst_object_unref (GST_OBJECT (element));
|
||||||
|
}
|
||||||
|
g_print ("create/unref %d elements %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("creating new element\n");
|
|
||||||
element = gst_element_new ();
|
element = gst_element_new ();
|
||||||
g_assert (GST_OBJECT_FLOATING (element));
|
g_assert (GST_OBJECT_FLOATING (element));
|
||||||
print_element_props (element);
|
|
||||||
g_print ("sink new element %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_ref (GST_OBJECT (element));
|
gst_object_ref (GST_OBJECT (element));
|
||||||
gst_object_sink (GST_OBJECT (element));
|
gst_object_sink (GST_OBJECT (element));
|
||||||
g_assert (!GST_OBJECT_FLOATING (element));
|
g_assert (!GST_OBJECT_FLOATING (element));
|
||||||
print_element_props (element);
|
|
||||||
g_print ("unref new element %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
|
g_print ("create/ref/sink/unref new element %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
|
||||||
|
for (i=0; i<iters;i++) {
|
||||||
element = gst_element_new ();
|
element = gst_element_new ();
|
||||||
|
gst_object_ref (GST_OBJECT (element));
|
||||||
|
gst_object_sink (GST_OBJECT (element));
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
}
|
}
|
||||||
g_print ("unref 100000 element %ld\n", vmsize()-usage1);
|
g_print ("create/ref/sink/unref %d elements %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("creating new element\n");
|
|
||||||
element = gst_element_new ();
|
element = gst_element_new ();
|
||||||
g_assert (!GST_OBJECT_DESTROYED (element));
|
g_assert (!GST_OBJECT_DESTROYED (element));
|
||||||
print_element_props (element);
|
|
||||||
g_print ("destroy new element %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_destroy (GST_OBJECT (element));
|
gst_object_destroy (GST_OBJECT (element));
|
||||||
g_assert (GST_OBJECT_DESTROYED (element));
|
g_assert (GST_OBJECT_DESTROYED (element));
|
||||||
print_element_props (element);
|
|
||||||
g_print ("unref new element %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
|
g_print ("create/destroy/unref new element %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
element = gst_element_new ();
|
element = gst_element_new ();
|
||||||
gst_object_destroy (GST_OBJECT (element));
|
gst_object_destroy (GST_OBJECT (element));
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 element %ld\n", vmsize()-usage1);
|
g_print ("create/destroy/unref %d element %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("creating new element\n");
|
|
||||||
element = gst_element_new ();
|
element = gst_element_new ();
|
||||||
gst_object_ref (GST_OBJECT (element));
|
gst_object_ref (GST_OBJECT (element));
|
||||||
print_element_props (element);
|
|
||||||
g_print ("unref new element %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
g_print ("unref new element %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
|
g_print ("create/ref/unref/unref new element %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
element = gst_element_new ();
|
element = gst_element_new ();
|
||||||
gst_object_ref (GST_OBJECT (element));
|
gst_object_ref (GST_OBJECT (element));
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 element %ld\n", vmsize()-usage1);
|
g_print ("create/ref/unref/unref %d element %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("creating new element\n");
|
|
||||||
element = gst_element_new ();
|
element = gst_element_new ();
|
||||||
gst_object_ref (GST_OBJECT (element));
|
gst_object_ref (GST_OBJECT (element));
|
||||||
print_element_props (element);
|
|
||||||
gst_object_destroy (GST_OBJECT (element));
|
gst_object_destroy (GST_OBJECT (element));
|
||||||
g_print ("unref new element %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
g_print ("unref new element %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
|
g_print ("craete/ref/destroy/unref/unref new element %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
element = gst_element_new ();
|
element = gst_element_new ();
|
||||||
gst_object_ref (GST_OBJECT (element));
|
gst_object_ref (GST_OBJECT (element));
|
||||||
gst_object_destroy (GST_OBJECT (element));
|
gst_object_destroy (GST_OBJECT (element));
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 element %ld\n", vmsize()-usage1);
|
g_print ("craete/ref/destroy/unref/unref %d elements %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
element = gst_element_new ();
|
element = gst_element_new ();
|
||||||
gst_object_ref (GST_OBJECT (element));
|
gst_object_ref (GST_OBJECT (element));
|
||||||
gst_element_set_name (element, "testing123");
|
gst_element_set_name (element, "testing123");
|
||||||
|
@ -107,16 +101,16 @@ main (int argc, gchar *argv[])
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 element %ld\n", vmsize()-usage1);
|
g_print ("craete/ref/destroy/unref/unref %d elements with name %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
element = gst_element_new ();
|
element = gst_element_new ();
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
gst_element_set_name (element, "testing");
|
gst_element_set_name (element, "testing");
|
||||||
}
|
}
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
g_print ("destroy/unref 100000 element %ld\n", vmsize()-usage1);
|
g_print ("set name %d times %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("leaked: %ld\n", vmsize()-usage1);
|
g_print ("leaked: %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
return 0;
|
return (vmsize()-usage1 ? -1 : 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,9 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
#define ITERS 100000
|
#define ITERS 100000
|
||||||
|
#include <stdlib.h>
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
|
|
||||||
static void
|
|
||||||
print_pad_props (GstPad *pad)
|
|
||||||
{
|
|
||||||
g_print ("name %s\n", gst_pad_get_name (pad));
|
|
||||||
g_print ("flags 0x%08x\n", GST_FLAGS (pad));
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstElement*
|
static GstElement*
|
||||||
create_element (gchar *padname, GstPadDirection dir)
|
create_element (gchar *padname, GstPadDirection dir)
|
||||||
{
|
{
|
||||||
|
@ -30,29 +24,34 @@ main (int argc, gchar *argv[])
|
||||||
GstElement *element2;
|
GstElement *element2;
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
long usage1;
|
long usage1;
|
||||||
gint i;
|
gint i, iters;
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
gst_init (&argc, &argv);
|
||||||
|
|
||||||
g_print ("creating new element\n");
|
if (argc == 2)
|
||||||
element = gst_element_new ();
|
iters = atoi (argv[1]);
|
||||||
|
else
|
||||||
|
iters = ITERS;
|
||||||
|
|
||||||
|
|
||||||
|
g_print ("starting element with pad test with %d iterations\n", iters);
|
||||||
usage1 = vmsize();
|
usage1 = vmsize();
|
||||||
|
|
||||||
pad = gst_pad_new ("sink", GST_PAD_SINK);
|
element = create_element ("sink", GST_PAD_SINK);
|
||||||
print_pad_props (pad);
|
pad = gst_element_get_pad (element, "sink");
|
||||||
gst_element_add_pad (element, pad);
|
g_assert (GST_OBJECT_FLOATING (element));
|
||||||
print_pad_props (pad);
|
g_assert (!GST_OBJECT_FLOATING (pad));
|
||||||
|
g_assert (gst_pad_get_parent (pad) == element);
|
||||||
g_print ("unref new element %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
|
g_print ("create/addpad/unref new element %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS; i++) {
|
for (i=0; i<iters; i++) {
|
||||||
element = create_element ("sink", GST_PAD_SINK);
|
element = create_element ("sink", GST_PAD_SINK);
|
||||||
gst_object_unref (GST_OBJECT (element));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 element %ld\n", vmsize()-usage1);
|
g_print ("create/addpad/unref %d elements %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS/2; i++) {
|
for (i=0; i<iters/2; i++) {
|
||||||
element = create_element ("sink", GST_PAD_SINK);
|
element = create_element ("sink", GST_PAD_SINK);
|
||||||
element2 = create_element ("src", GST_PAD_SRC);
|
element2 = create_element ("src", GST_PAD_SRC);
|
||||||
gst_element_connect (element, "sink", element2, "src");
|
gst_element_connect (element, "sink", element2, "src");
|
||||||
|
@ -62,9 +61,9 @@ main (int argc, gchar *argv[])
|
||||||
g_assert (!GST_PAD_CONNECTED (gst_element_get_pad (element2, "src")));
|
g_assert (!GST_PAD_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||||
gst_object_unref (GST_OBJECT (element2));
|
gst_object_unref (GST_OBJECT (element2));
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 element %ld\n", vmsize()-usage1);
|
g_print ("create/connect/unref %d elements %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("leaked: %ld\n", vmsize()-usage1);
|
g_print ("leaked: %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
return 0;
|
return (vmsize()-usage1 ? -1 : 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,104 +1,97 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
#define ITERS 100000
|
#define ITERS 100000
|
||||||
|
#include <stdlib.h>
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
|
|
||||||
static void
|
|
||||||
print_object_props (GstObject *object)
|
|
||||||
{
|
|
||||||
g_print ("name %s\n", gst_object_get_name (object));
|
|
||||||
g_print ("flags 0x%08lx\n", GST_FLAGS (object));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, gchar *argv[])
|
main (int argc, gchar *argv[])
|
||||||
{
|
{
|
||||||
GstObject *object;
|
GstObject *object, *object2;
|
||||||
long usage1, usage2;
|
long usage1;
|
||||||
gint i;
|
gint i, iters;
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
gst_init (&argc, &argv);
|
||||||
|
|
||||||
g_print ("creating new object\n");
|
if (argc == 2)
|
||||||
object = gst_object_new ();
|
iters = atoi (argv[1]);
|
||||||
|
else
|
||||||
|
iters = ITERS;
|
||||||
|
|
||||||
|
g_print ("starting test with %d iterations\n", iters);
|
||||||
usage1 = vmsize();
|
usage1 = vmsize();
|
||||||
print_object_props (object);
|
object = gst_object_new ();
|
||||||
g_print ("unref new object %ld\n", vmsize()-usage1);
|
gst_object_unref (object);
|
||||||
|
g_print ("create/unref new object %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
|
for (i=0; i<iters;i++) {
|
||||||
|
object = gst_object_new ();
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
|
|
||||||
g_print ("creating new object\n");
|
}
|
||||||
|
g_print ("create/unref %d object %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
object = gst_object_new ();
|
object = gst_object_new ();
|
||||||
g_assert (GST_OBJECT_FLOATING (object));
|
g_assert (GST_OBJECT_FLOATING (object));
|
||||||
print_object_props (object);
|
|
||||||
g_print ("sink new object %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_ref (object);
|
gst_object_ref (object);
|
||||||
gst_object_sink (object);
|
gst_object_sink (object);
|
||||||
g_assert (!GST_OBJECT_FLOATING (object));
|
g_assert (!GST_OBJECT_FLOATING (object));
|
||||||
print_object_props (object);
|
|
||||||
g_print ("unref new object %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
|
g_print ("create/ref/sink/unref new object %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
object = gst_object_new ();
|
object = gst_object_new ();
|
||||||
|
gst_object_ref (object);
|
||||||
|
gst_object_sink (object);
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
}
|
}
|
||||||
g_print ("unref 100000 object %ld\n", vmsize()-usage1);
|
g_print ("create/ref/sink/unref %d object %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("creating new object\n");
|
|
||||||
object = gst_object_new ();
|
object = gst_object_new ();
|
||||||
g_assert (!GST_OBJECT_DESTROYED (object));
|
g_assert (!GST_OBJECT_DESTROYED (object));
|
||||||
print_object_props (object);
|
|
||||||
g_print ("destroy new object %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_destroy (object);
|
gst_object_destroy (object);
|
||||||
g_assert (GST_OBJECT_DESTROYED (object));
|
g_assert (GST_OBJECT_DESTROYED (object));
|
||||||
print_object_props (object);
|
|
||||||
g_print ("unref new object %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
|
g_print ("create/destroy/unref new object %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
object = gst_object_new ();
|
object = gst_object_new ();
|
||||||
gst_object_destroy (object);
|
gst_object_destroy (object);
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 object %ld\n", vmsize()-usage1);
|
g_print ("destroy/unref %d object %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("creating new object\n");
|
|
||||||
object = gst_object_new ();
|
object = gst_object_new ();
|
||||||
gst_object_ref (object);
|
gst_object_ref (object);
|
||||||
print_object_props (object);
|
|
||||||
g_print ("unref new object %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
g_print ("unref new object %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
|
g_print ("create/ref/unref/unref new object %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
object = gst_object_new ();
|
object = gst_object_new ();
|
||||||
gst_object_ref (object);
|
gst_object_ref (object);
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 object %ld\n", vmsize()-usage1);
|
g_print ("create/ref/unref/unref %d object %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("creating new object\n");
|
|
||||||
object = gst_object_new ();
|
object = gst_object_new ();
|
||||||
gst_object_ref (object);
|
gst_object_ref (object);
|
||||||
print_object_props (object);
|
|
||||||
gst_object_destroy (object);
|
gst_object_destroy (object);
|
||||||
g_print ("unref new object %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
g_print ("unref new object %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
|
g_print ("create/ref/destroy/unref/unref new object %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
object = gst_object_new ();
|
object = gst_object_new ();
|
||||||
gst_object_ref (object);
|
gst_object_ref (object);
|
||||||
gst_object_destroy (object);
|
gst_object_destroy (object);
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 object %ld\n", vmsize()-usage1);
|
g_print ("create/ref/destroy/unref/unref %d object %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
object = gst_object_new ();
|
object = gst_object_new ();
|
||||||
gst_object_ref (object);
|
gst_object_ref (object);
|
||||||
gst_object_set_name (object, "testing123");
|
gst_object_set_name (object, "testing123");
|
||||||
|
@ -107,16 +100,57 @@ main (int argc, gchar *argv[])
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 object %ld\n", vmsize()-usage1);
|
g_print ("create/ref/destroy/unref/unref %d object with name %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
object = gst_object_new ();
|
object = gst_object_new ();
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
gst_object_set_name (object, "testing");
|
gst_object_set_name (object, "testing");
|
||||||
}
|
}
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
g_print ("destroy/unref 100000 object %ld\n", vmsize()-usage1);
|
g_print ("create/set name/unref %d object %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
|
object = gst_object_new ();
|
||||||
|
object2 = gst_object_new ();
|
||||||
|
g_assert (GST_OBJECT_FLOATING (object));
|
||||||
|
g_assert (GST_OBJECT_FLOATING (object2));
|
||||||
|
|
||||||
|
gst_object_set_parent (object, object2);
|
||||||
|
g_assert (GST_OBJECT_FLOATING (object2));
|
||||||
|
g_assert (!GST_OBJECT_FLOATING (object));
|
||||||
|
|
||||||
|
g_print ("parentage flags set_parent ok %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
|
gst_object_ref (object);
|
||||||
|
gst_object_unparent (object);
|
||||||
|
g_assert (GST_OBJECT_FLOATING (object2));
|
||||||
|
g_assert (!GST_OBJECT_FLOATING (object));
|
||||||
|
g_assert (gst_object_get_parent (object) == NULL);
|
||||||
|
|
||||||
|
g_print ("parentage flags unparent ok %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
|
gst_object_set_parent (object, object2);
|
||||||
|
g_assert (GST_OBJECT_FLOATING (object2));
|
||||||
|
g_assert (!GST_OBJECT_FLOATING (object));
|
||||||
|
g_assert (gst_object_get_parent (object) == object2);
|
||||||
|
|
||||||
|
gst_object_destroy (object);
|
||||||
|
g_assert (GST_OBJECT_DESTROYED (object));
|
||||||
|
g_assert (!GST_OBJECT_FLOATING (object));
|
||||||
|
g_assert (gst_object_get_parent (object) == NULL);
|
||||||
|
gst_object_unref (object);
|
||||||
|
|
||||||
|
g_print ("parentage flags destroy ok %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
|
for (i=0; i<iters;i++) {
|
||||||
|
object = gst_object_new ();
|
||||||
|
object2 = gst_object_new ();
|
||||||
|
gst_object_set_parent (object2, object);
|
||||||
|
gst_object_unref (object);
|
||||||
|
gst_object_unref (object2);
|
||||||
|
}
|
||||||
|
g_print ("create/unref %d 2 parented objects %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("leaked: %ld\n", vmsize()-usage1);
|
g_print ("leaked: %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
return 0;
|
return (vmsize()-usage1 ? -1 : 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,9 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
#define ITERS 100000
|
#define ITERS 100000
|
||||||
|
#include <stdlib.h>
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
|
|
||||||
static void
|
|
||||||
print_pad_props (GstPad *pad)
|
|
||||||
{
|
|
||||||
g_print ("name %s\n", gst_pad_get_name (pad));
|
|
||||||
g_print ("flags 0x%08x\n", GST_FLAGS (pad));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, gchar *argv[])
|
main (int argc, gchar *argv[])
|
||||||
{
|
{
|
||||||
|
@ -17,90 +11,89 @@ main (int argc, gchar *argv[])
|
||||||
GstPad *pad2;
|
GstPad *pad2;
|
||||||
GstPadTemplate *padtempl;
|
GstPadTemplate *padtempl;
|
||||||
long usage1;
|
long usage1;
|
||||||
gint i;
|
gint i, iters;
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
gst_init (&argc, &argv);
|
||||||
|
|
||||||
g_print ("creating new pad\n");
|
if (argc == 2)
|
||||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
iters = atoi (argv[1]);
|
||||||
usage1 = vmsize();
|
else
|
||||||
print_pad_props (pad);
|
iters = ITERS;
|
||||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
g_print ("starting pad test\n");
|
||||||
|
usage1 = vmsize();
|
||||||
|
|
||||||
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
g_print ("create/unref new pad %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
|
for (i=0; i<iters;i++) {
|
||||||
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
}
|
||||||
|
g_print ("create/unref %d pads %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("creating new pad\n");
|
|
||||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
g_assert (GST_OBJECT_FLOATING (pad));
|
g_assert (GST_OBJECT_FLOATING (pad));
|
||||||
print_pad_props (pad);
|
|
||||||
g_print ("sink new pad %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_ref (GST_OBJECT (pad));
|
gst_object_ref (GST_OBJECT (pad));
|
||||||
gst_object_sink (GST_OBJECT (pad));
|
gst_object_sink (GST_OBJECT (pad));
|
||||||
g_assert (!GST_OBJECT_FLOATING (pad));
|
g_assert (!GST_OBJECT_FLOATING (pad));
|
||||||
print_pad_props (pad);
|
|
||||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
g_print ("create/ref/sink/unref new pad %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
|
gst_object_ref (GST_OBJECT (pad));
|
||||||
|
gst_object_sink (GST_OBJECT (pad));
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
}
|
}
|
||||||
g_print ("unref 100000 pad %ld\n", vmsize()-usage1);
|
g_print ("create/ref/sink/unref %d pads %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("creating new pad\n");
|
|
||||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
g_assert (!GST_OBJECT_DESTROYED (pad));
|
g_assert (!GST_OBJECT_DESTROYED (pad));
|
||||||
print_pad_props (pad);
|
|
||||||
g_print ("destroy new pad %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_destroy (GST_OBJECT (pad));
|
gst_object_destroy (GST_OBJECT (pad));
|
||||||
g_assert (GST_OBJECT_DESTROYED (pad));
|
g_assert (GST_OBJECT_DESTROYED (pad));
|
||||||
print_pad_props (pad);
|
|
||||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
g_print ("create/destroy/unref pad %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
gst_object_destroy (GST_OBJECT (pad));
|
gst_object_destroy (GST_OBJECT (pad));
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 pad %ld\n", vmsize()-usage1);
|
g_print ("create/destroy/unref %d pads %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("creating new pad\n");
|
|
||||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
gst_object_ref (GST_OBJECT (pad));
|
gst_object_ref (GST_OBJECT (pad));
|
||||||
print_pad_props (pad);
|
|
||||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
g_print ("create/ref/unref/unref pad %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
gst_object_ref (GST_OBJECT (pad));
|
gst_object_ref (GST_OBJECT (pad));
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 pad %ld\n", vmsize()-usage1);
|
g_print ("create/ref/unref/unref %d pads %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("creating new pad\n");
|
|
||||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
gst_object_ref (GST_OBJECT (pad));
|
gst_object_ref (GST_OBJECT (pad));
|
||||||
print_pad_props (pad);
|
|
||||||
gst_object_destroy (GST_OBJECT (pad));
|
gst_object_destroy (GST_OBJECT (pad));
|
||||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
g_print ("create/ref/destroy/unref/unref pad %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
gst_object_ref (GST_OBJECT (pad));
|
gst_object_ref (GST_OBJECT (pad));
|
||||||
gst_object_destroy (GST_OBJECT (pad));
|
gst_object_destroy (GST_OBJECT (pad));
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 pad %ld\n", vmsize()-usage1);
|
g_print ("create/ref/destroy/unref/unref %d pads %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
gst_object_ref (GST_OBJECT (pad));
|
gst_object_ref (GST_OBJECT (pad));
|
||||||
gst_pad_set_name (pad, "testing123");
|
gst_pad_set_name (pad, "testing123");
|
||||||
|
@ -109,41 +102,122 @@ main (int argc, gchar *argv[])
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
}
|
}
|
||||||
g_print ("destroy/unref 100000 pad %ld\n", vmsize()-usage1);
|
g_print ("create/ref/destroy/unref/unref %d pads %ld with name\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
for (i=0; i<ITERS;i++) {
|
for (i=0; i<iters;i++) {
|
||||||
gst_pad_set_name (pad, "testing");
|
gst_pad_set_name (pad, "testing");
|
||||||
}
|
}
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
g_print ("destroy/unref 100000 pad %ld\n", vmsize()-usage1);
|
g_print ("set name %d times %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("connecting pad %ld\n", vmsize()-usage1);
|
|
||||||
|
|
||||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||||
|
|
||||||
|
gst_pad_connect (pad2, pad);
|
||||||
|
g_assert (GST_PAD_CONNECTED (pad));
|
||||||
|
g_assert (GST_PAD_CONNECTED (pad2));
|
||||||
|
gst_pad_disconnect (pad2, pad);
|
||||||
|
g_assert (!GST_PAD_CONNECTED (pad));
|
||||||
|
g_assert (!GST_PAD_CONNECTED (pad2));
|
||||||
|
g_print ("connect/disconnect pad %ld\n", vmsize()-usage1);
|
||||||
gst_pad_connect (pad, pad2);
|
gst_pad_connect (pad, pad2);
|
||||||
|
g_assert (GST_PAD_CONNECTED (pad));
|
||||||
|
g_assert (GST_PAD_CONNECTED (pad2));
|
||||||
gst_pad_disconnect (pad, pad2);
|
gst_pad_disconnect (pad, pad2);
|
||||||
|
g_assert (!GST_PAD_CONNECTED (pad));
|
||||||
|
g_assert (!GST_PAD_CONNECTED (pad2));
|
||||||
|
g_print ("connect/disconnect pad wrong direction %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
gst_object_unref (GST_OBJECT (pad2));
|
||||||
|
|
||||||
|
for (i=0; i<iters;i++) {
|
||||||
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
|
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||||
gst_pad_connect (pad2, pad);
|
gst_pad_connect (pad2, pad);
|
||||||
gst_pad_disconnect (pad2, pad);
|
gst_pad_disconnect (pad2, pad);
|
||||||
|
gst_pad_connect (pad, pad2);
|
||||||
|
gst_pad_disconnect (pad, pad2);
|
||||||
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
gst_object_unref (GST_OBJECT (pad2));
|
||||||
|
}
|
||||||
|
g_print ("connect/disconnect %d pads %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("padtemplates create/destroy %ld\n", vmsize()-usage1);
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
|
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
gst_pad_connect (pad2, pad);
|
||||||
|
g_assert (GST_PAD_CONNECTED (pad2));
|
||||||
|
g_assert (GST_PAD_CONNECTED (pad));
|
||||||
|
|
||||||
|
gst_object_unref (GST_OBJECT (pad2));
|
||||||
|
g_assert (!GST_PAD_CONNECTED (pad));
|
||||||
|
g_assert (!GST_OBJECT_DESTROYED (pad));
|
||||||
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
|
||||||
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
|
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||||
|
|
||||||
|
gst_pad_connect (pad2, pad);
|
||||||
|
g_assert (GST_PAD_CONNECTED (pad2));
|
||||||
|
g_assert (GST_PAD_CONNECTED (pad));
|
||||||
|
|
||||||
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
g_assert (!GST_PAD_CONNECTED (pad2));
|
||||||
|
g_assert (!GST_OBJECT_DESTROYED (pad2));
|
||||||
|
gst_object_unref (GST_OBJECT (pad2));
|
||||||
|
|
||||||
|
g_print ("pad unref effects on connect pad ok %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
|
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||||
|
|
||||||
|
gst_pad_connect (pad2, pad);
|
||||||
|
g_assert (GST_PAD_CONNECTED (pad2));
|
||||||
|
g_assert (GST_PAD_CONNECTED (pad));
|
||||||
|
|
||||||
|
gst_object_destroy (GST_OBJECT (pad2));
|
||||||
|
g_assert (GST_OBJECT_DESTROYED (pad2));
|
||||||
|
g_assert (!GST_OBJECT_DESTROYED (pad));
|
||||||
|
g_assert (!GST_PAD_CONNECTED (pad));
|
||||||
|
gst_object_unref (GST_OBJECT (pad2));
|
||||||
|
g_assert (!GST_OBJECT_DESTROYED (pad));
|
||||||
|
g_assert (!GST_PAD_CONNECTED (pad));
|
||||||
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
|
||||||
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||||
|
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||||
|
|
||||||
|
gst_pad_connect (pad2, pad);
|
||||||
|
g_assert (GST_PAD_CONNECTED (pad2));
|
||||||
|
g_assert (GST_PAD_CONNECTED (pad));
|
||||||
|
|
||||||
|
gst_object_destroy (GST_OBJECT (pad));
|
||||||
|
g_assert (GST_OBJECT_DESTROYED (pad));
|
||||||
|
g_assert (!GST_OBJECT_DESTROYED (pad2));
|
||||||
|
g_assert (!GST_PAD_CONNECTED (pad2));
|
||||||
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
g_assert (!GST_OBJECT_DESTROYED (pad2));
|
||||||
|
g_assert (!GST_PAD_CONNECTED (pad2));
|
||||||
|
gst_object_unref (GST_OBJECT (pad2));
|
||||||
|
|
||||||
|
g_print ("pad destroy effects on connect pad ok %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
|
for (i=0; i<iters;i++) {
|
||||||
padtempl = gst_padtemplate_new ("sink%d", GST_PAD_SINK, GST_PAD_SOMETIMES, NULL);
|
padtempl = gst_padtemplate_new ("sink%d", GST_PAD_SINK, GST_PAD_SOMETIMES, NULL);
|
||||||
gst_object_unref (GST_OBJECT (padtempl));
|
gst_object_unref (GST_OBJECT (padtempl));
|
||||||
}
|
}
|
||||||
|
g_print ("%d padtemplates create/unref %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("padtemplates create/destroy on pad %ld\n", vmsize()-usage1);
|
for (i=0; i<iters;i++) {
|
||||||
|
|
||||||
for (i=0; i<ITERS;i++) {
|
|
||||||
padtempl = gst_padtemplate_new ("sink%d", GST_PAD_SINK, GST_PAD_SOMETIMES, NULL);
|
padtempl = gst_padtemplate_new ("sink%d", GST_PAD_SINK, GST_PAD_SOMETIMES, NULL);
|
||||||
pad = gst_pad_new_from_template (padtempl, "sink1");
|
pad = gst_pad_new_from_template (padtempl, "sink1");
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
}
|
}
|
||||||
|
g_print ("%d pads create/unref from padtemplate %ld\n", iters, vmsize()-usage1);
|
||||||
|
|
||||||
g_print ("leaked: %ld\n", vmsize()-usage1);
|
g_print ("leaked: %ld\n", vmsize()-usage1);
|
||||||
|
|
||||||
return 0;
|
return vmsize()-usage1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue