8 main (int argc, gchar *argv[])
14 gst_init (&argc, &argv);
17 iters = atoi (argv[1]);
21 g_print ("starting test\n");
24 element = gst_element_factory_make ("fakesrc", NULL);
25 gst_object_unref (GST_OBJECT (element));
26 g_print ("create/unref new element %ld\n", vmsize()-usage1);
28 for (i=0; i<iters;i++) {
29 element = gst_element_factory_make ("fakesrc", NULL);
30 gst_object_unref (GST_OBJECT (element));
32 g_print ("create/unref %d elements %ld\n", iters, vmsize()-usage1);
34 element = gst_element_factory_make ("fakesrc", NULL);
35 g_assert (GST_OBJECT_FLOATING (element));
36 gst_object_ref (GST_OBJECT (element));
37 gst_object_sink (GST_OBJECT (element));
38 g_assert (!GST_OBJECT_FLOATING (element));
39 gst_object_unref (GST_OBJECT (element));
40 g_print ("create/ref/sink/unref new element %ld\n", vmsize()-usage1);
43 for (i=0; i<iters;i++) {
44 element = gst_element_factory_make ("fakesrc", NULL);
45 gst_object_ref (GST_OBJECT (element));
46 gst_object_sink (GST_OBJECT (element));
47 gst_object_unref (GST_OBJECT (element));
49 g_print ("create/ref/sink/unref %d elements %ld\n", iters, vmsize()-usage1);
51 element = gst_element_factory_make ("fakesrc", NULL);
52 g_assert (!GST_OBJECT_DESTROYED (element));
53 gst_object_unref (GST_OBJECT (element));
54 g_assert (GST_OBJECT_DESTROYED (element));
55 gst_object_unref (GST_OBJECT (element));
56 g_print ("create/destroy/unref new element %ld\n", vmsize()-usage1);
58 for (i=0; i<iters;i++) {
59 element = gst_element_factory_make ("fakesrc", NULL);
60 gst_object_unref (GST_OBJECT (element));
61 gst_object_unref (GST_OBJECT (element));
63 g_print ("create/destroy/unref %d element %ld\n", iters, vmsize()-usage1);
65 element = gst_element_factory_make ("fakesrc", NULL);
66 gst_object_ref (GST_OBJECT (element));
67 gst_object_unref (GST_OBJECT (element));
68 gst_object_unref (GST_OBJECT (element));
69 g_print ("create/ref/unref/unref new element %ld\n", vmsize()-usage1);
71 for (i=0; i<iters;i++) {
72 element = gst_element_factory_make ("fakesrc", NULL);
73 gst_object_ref (GST_OBJECT (element));
74 gst_object_unref (GST_OBJECT (element));
75 gst_object_unref (GST_OBJECT (element));
77 g_print ("create/ref/unref/unref %d element %ld\n", iters, vmsize()-usage1);
79 element = gst_element_factory_make ("fakesrc", NULL);
80 gst_object_ref (GST_OBJECT (element));
81 gst_object_unref (GST_OBJECT (element));
82 gst_object_unref (GST_OBJECT (element));
83 gst_object_unref (GST_OBJECT (element));
84 g_print ("craete/ref/destroy/unref/unref new element %ld\n", vmsize()-usage1);
86 for (i=0; i<iters;i++) {
87 element = gst_element_factory_make ("fakesrc", NULL);
88 gst_object_ref (GST_OBJECT (element));
89 gst_object_unref (GST_OBJECT (element));
90 gst_object_unref (GST_OBJECT (element));
91 gst_object_unref (GST_OBJECT (element));
93 g_print ("craete/ref/destroy/unref/unref %d elements %ld\n", iters, vmsize()-usage1);
95 for (i=0; i<iters;i++) {
96 element = gst_element_factory_make ("fakesrc", NULL);
97 gst_object_ref (GST_OBJECT (element));
98 gst_element_set_name (element, "testing123");
99 gst_object_unref (GST_OBJECT (element));
100 gst_element_set_name (element, "testing123");
101 gst_object_unref (GST_OBJECT (element));
102 gst_object_unref (GST_OBJECT (element));
104 g_print ("craete/ref/destroy/unref/unref %d elements with name %ld\n", iters, vmsize()-usage1);
106 element = gst_element_factory_make ("fakesrc", NULL);
107 for (i=0; i<iters;i++) {
108 gst_element_set_name (element, "testing");
110 gst_object_unref (GST_OBJECT (element));
111 g_print ("set name %d times %ld\n", iters, vmsize()-usage1);
113 g_print ("leaked: %ld\n", vmsize()-usage1);
115 return (vmsize()-usage1 ? -1 : 0);