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"
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
|
|
|
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++) {
|
2001-05-25 21:00:07 +00:00
|
|
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
|
|
|
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
|
|
|
|
|
|
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
|
|
|
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++) {
|
2001-05-25 21:00:07 +00:00
|
|
|
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));
|
|
|
|
}
|
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
|
|
|
|
2003-10-15 01:25:41 +00:00
|
|
|
#if 0
|
2001-05-25 21:00:07 +00:00
|
|
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
|
|
|
g_assert (!GST_OBJECT_DESTROYED (pad));
|
2003-04-15 18:17:24 +00:00
|
|
|
gst_object_unref (GST_OBJECT (pad));
|
2001-05-25 21:00:07 +00:00
|
|
|
g_assert (GST_OBJECT_DESTROYED (pad));
|
|
|
|
gst_object_unref (GST_OBJECT (pad));
|
2004-03-13 15:27:01 +00:00
|
|
|
g_print ("create/destroy/unref pad %ld\n", vmsize () - usage1);
|
2003-10-15 01:25:41 +00:00
|
|
|
#endif
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-10-15 01:25:41 +00:00
|
|
|
#if 0
|
2004-03-13 15:27:01 +00:00
|
|
|
for (i = 0; i < iters; i++) {
|
2001-05-25 21:00:07 +00:00
|
|
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
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-03-13 15:27:01 +00:00
|
|
|
g_print ("create/destroy/unref %d pads %ld\n", iters, vmsize () - usage1);
|
2003-10-15 01:25:41 +00:00
|
|
|
#endif
|
2001-05-25 21:00:07 +00:00
|
|
|
|
|
|
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
|
|
|
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++) {
|
2001-05-25 21:00:07 +00:00
|
|
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
|
|
|
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
|
|
|
|
|
|
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
|
|
|
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));
|
2003-10-15 01:25:41 +00:00
|
|
|
#if 0
|
2001-05-25 21:00:07 +00:00
|
|
|
gst_object_unref (GST_OBJECT (pad));
|
2003-10-15 01:25:41 +00:00
|
|
|
#endif
|
2004-03-13 15:27:01 +00:00
|
|
|
g_print ("create/ref/destroy/unref/unref pad %ld\n", vmsize () - usage1);
|
|
|
|
|
2003-10-15 01:25:41 +00:00
|
|
|
#if 0
|
2004-03-13 15:27:01 +00:00
|
|
|
for (i = 0; i < iters; i++) {
|
2001-05-25 21:00:07 +00:00
|
|
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
|
|
|
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));
|
2003-10-15 01:25:41 +00:00
|
|
|
//gst_object_unref (GST_OBJECT (pad));
|
2001-05-25 21:00:07 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
g_print ("create/ref/destroy/unref/unref %d pads %ld\n", iters,
|
|
|
|
vmsize () - usage1);
|
2003-10-15 01:25:41 +00:00
|
|
|
#endif
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2003-10-15 01:25:41 +00:00
|
|
|
#if 0
|
2004-03-13 15:27:01 +00:00
|
|
|
for (i = 0; i < iters; i++) {
|
2001-05-25 21:00:07 +00:00
|
|
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
|
|
|
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));
|
|
|
|
gst_object_unref (GST_OBJECT (pad));
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
g_print ("create/ref/destroy/unref/unref %d pads %ld with name\n", iters,
|
|
|
|
vmsize () - usage1);
|
2003-10-15 01:25:41 +00:00
|
|
|
#endif
|
2001-05-25 21:00:07 +00:00
|
|
|
|
|
|
|
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
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 =
|
|
|
|
gst_pad_template_new ("sink%d", GST_PAD_SINK, GST_PAD_SOMETIMES, NULL);
|
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 =
|
|
|
|
gst_pad_template_new ("sink%d", GST_PAD_SINK, GST_PAD_SOMETIMES, NULL);
|
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-03-13 15:27:01 +00:00
|
|
|
return vmsize () - usage1;
|
2001-05-25 21:00:07 +00:00
|
|
|
}
|