2001-05-25 21:00:07 +00:00
|
|
|
#include <gst/gst.h>
|
|
|
|
|
2003-10-15 01:25:41 +00:00
|
|
|
#define ITERS 100
|
2001-05-25 21:00:07 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include "mem.h"
|
|
|
|
|
2004-08-17 10:16:35 +00:00
|
|
|
GstStaticPadTemplate templ = GST_STATIC_PAD_TEMPLATE ("default",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
int
|
2004-03-13 15:27:01 +00:00
|
|
|
main (int argc, gchar * argv[])
|
2001-05-25 21:00:07 +00:00
|
|
|
{
|
|
|
|
GstPad *pad;
|
|
|
|
GstPadTemplate *padtempl;
|
|
|
|
long usage1;
|
|
|
|
gint i, iters;
|
|
|
|
|
2003-10-15 01:25:41 +00:00
|
|
|
gst_alloc_trace_set_flags_all (GST_ALLOC_TRACE_LIVE);
|
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
gst_init (&argc, &argv);
|
|
|
|
|
2003-10-15 01:25:41 +00:00
|
|
|
g_mem_profile ();
|
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
if (argc == 2)
|
|
|
|
iters = atoi (argv[1]);
|
|
|
|
else
|
|
|
|
iters = ITERS;
|
|
|
|
|
2003-10-15 01:25:41 +00:00
|
|
|
//gst_alloc_trace_print_all ();
|
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
g_print ("starting pad test\n");
|
2004-03-13 15:27:01 +00:00
|
|
|
usage1 = vmsize ();
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2004-04-13 10:57:53 +00:00
|
|
|
g_print ("DEBUG: creating new pad with name padname\n");
|
2004-08-17 10:16:35 +00:00
|
|
|
pad =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get (&templ),
|
|
|
|
"padname");
|
2004-04-13 10:57:53 +00:00
|
|
|
g_print ("DEBUG: unreffing new pad with name padname\n");
|
2001-05-25 21:00:07 +00:00
|
|
|
gst_object_unref (GST_OBJECT (pad));
|
2004-03-13 15:27:01 +00:00
|
|
|
g_print ("create/unref new pad %ld\n", vmsize () - usage1);
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
for (i = 0; i < iters; i++) {
|
2004-08-17 10:16:35 +00:00
|
|
|
pad =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get (&templ),
|
|
|
|
"padname");
|
2001-05-25 21:00:07 +00:00
|
|
|
gst_object_unref (GST_OBJECT (pad));
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
g_print ("create/unref %d pads %ld\n", iters, vmsize () - usage1);
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2004-08-17 10:16:35 +00:00
|
|
|
pad =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get (&templ),
|
|
|
|
"padname");
|
2001-05-25 21:00:07 +00:00
|
|
|
g_assert (GST_OBJECT_FLOATING (pad));
|
|
|
|
gst_object_ref (GST_OBJECT (pad));
|
|
|
|
gst_object_sink (GST_OBJECT (pad));
|
|
|
|
g_assert (!GST_OBJECT_FLOATING (pad));
|
|
|
|
gst_object_unref (GST_OBJECT (pad));
|
2004-03-13 15:27:01 +00:00
|
|
|
g_print ("create/ref/sink/unref new pad %ld\n", vmsize () - usage1);
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
for (i = 0; i < iters; i++) {
|
2004-08-17 10:16:35 +00:00
|
|
|
pad =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get (&templ),
|
|
|
|
"padname");
|
2001-05-25 21:00:07 +00:00
|
|
|
gst_object_ref (GST_OBJECT (pad));
|
|
|
|
gst_object_sink (GST_OBJECT (pad));
|
|
|
|
gst_object_unref (GST_OBJECT (pad));
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
g_print ("create/ref/sink/unref %d pads %ld\n", iters, vmsize () - usage1);
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2004-08-17 10:16:35 +00:00
|
|
|
pad =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get (&templ),
|
|
|
|
"padname");
|
2001-05-25 21:00:07 +00:00
|
|
|
gst_object_ref (GST_OBJECT (pad));
|
|
|
|
gst_object_unref (GST_OBJECT (pad));
|
|
|
|
gst_object_unref (GST_OBJECT (pad));
|
2004-03-13 15:27:01 +00:00
|
|
|
g_print ("create/ref/unref/unref pad %ld\n", vmsize () - usage1);
|
|
|
|
|
|
|
|
for (i = 0; i < iters; i++) {
|
2004-08-17 10:16:35 +00:00
|
|
|
pad =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get (&templ),
|
|
|
|
"padname");
|
2001-05-25 21:00:07 +00:00
|
|
|
gst_object_ref (GST_OBJECT (pad));
|
|
|
|
gst_object_unref (GST_OBJECT (pad));
|
|
|
|
gst_object_unref (GST_OBJECT (pad));
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
g_print ("create/ref/unref/unref %d pads %ld\n", iters, vmsize () - usage1);
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2004-08-17 10:16:35 +00:00
|
|
|
pad =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get (&templ),
|
|
|
|
"padname");
|
2001-05-25 21:00:07 +00:00
|
|
|
gst_object_ref (GST_OBJECT (pad));
|
2003-04-15 18:17:24 +00:00
|
|
|
gst_object_unref (GST_OBJECT (pad));
|
2001-05-25 21:00:07 +00:00
|
|
|
gst_object_unref (GST_OBJECT (pad));
|
2004-08-17 10:16:35 +00:00
|
|
|
g_print ("create/ref/unref/unref pad %ld\n", vmsize () - usage1);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
for (i = 0; i < iters; i++) {
|
2004-08-17 10:16:35 +00:00
|
|
|
pad =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get (&templ),
|
|
|
|
"padname");
|
2001-05-25 21:00:07 +00:00
|
|
|
gst_object_ref (GST_OBJECT (pad));
|
2003-04-15 18:17:24 +00:00
|
|
|
gst_object_unref (GST_OBJECT (pad));
|
2001-05-25 21:00:07 +00:00
|
|
|
gst_object_unref (GST_OBJECT (pad));
|
|
|
|
}
|
2004-08-17 10:16:35 +00:00
|
|
|
g_print ("create/ref/unref/unref %d pads %ld\n", iters, vmsize () - usage1);
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
for (i = 0; i < iters; i++) {
|
2004-08-17 10:16:35 +00:00
|
|
|
pad =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get (&templ),
|
|
|
|
"padname");
|
2001-05-25 21:00:07 +00:00
|
|
|
gst_object_ref (GST_OBJECT (pad));
|
|
|
|
gst_pad_set_name (pad, "testing123");
|
2003-04-15 18:17:24 +00:00
|
|
|
gst_object_unref (GST_OBJECT (pad));
|
2001-05-25 21:00:07 +00:00
|
|
|
gst_pad_set_name (pad, "testing123");
|
|
|
|
gst_object_unref (GST_OBJECT (pad));
|
|
|
|
}
|
2004-08-17 10:16:35 +00:00
|
|
|
g_print ("create/ref/unref/unref %d pads %ld with name\n", iters,
|
2004-03-13 15:27:01 +00:00
|
|
|
vmsize () - usage1);
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2004-08-17 10:16:35 +00:00
|
|
|
pad =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get (&templ),
|
|
|
|
"padname");
|
2004-03-13 15:27:01 +00:00
|
|
|
for (i = 0; i < iters; i++) {
|
2001-05-25 21:00:07 +00:00
|
|
|
gst_pad_set_name (pad, "testing");
|
|
|
|
}
|
|
|
|
gst_object_unref (GST_OBJECT (pad));
|
2004-03-13 15:27:01 +00:00
|
|
|
g_print ("set name %d times %ld\n", iters, vmsize () - usage1);
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
for (i = 0; i < iters; i++) {
|
|
|
|
padtempl =
|
2004-04-22 05:08:19 +00:00
|
|
|
gst_pad_template_new ("sink%d", GST_PAD_SINK, GST_PAD_SOMETIMES,
|
|
|
|
gst_caps_new_any ());
|
2001-05-25 21:00:07 +00:00
|
|
|
gst_object_unref (GST_OBJECT (padtempl));
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
g_print ("%d padtemplates create/unref %ld\n", iters, vmsize () - usage1);
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
for (i = 0; i < iters; i++) {
|
|
|
|
padtempl =
|
2004-04-22 05:08:19 +00:00
|
|
|
gst_pad_template_new ("sink%d", GST_PAD_SINK, GST_PAD_SOMETIMES,
|
|
|
|
gst_caps_new_any ());
|
2001-05-25 21:00:07 +00:00
|
|
|
pad = gst_pad_new_from_template (padtempl, "sink1");
|
|
|
|
gst_object_unref (GST_OBJECT (pad));
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
g_print ("%d pads create/unref from padtemplate %ld\n", iters,
|
|
|
|
vmsize () - usage1);
|
|
|
|
|
|
|
|
g_print ("leaked: %ld\n", vmsize () - usage1);
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2003-10-15 01:25:41 +00:00
|
|
|
//gst_alloc_trace_print_all ();
|
|
|
|
|
2004-04-15 04:54:53 +00:00
|
|
|
return 0;
|
2001-05-25 21:00:07 +00:00
|
|
|
}
|