Hi, gstreamer-devel:<br><br>&nbsp;&nbsp;&nbsp; 1. The `finalize&#39; function will only be called once. The `dispose&#39; function can be called many times.<br><br>&nbsp;&nbsp;&nbsp; 2. Usually we use `g_object_unref&#39; or `gst_object_unref&#39;(in gstreamer) to release the object. If the ref_count of this object reaches zero, the `dispose&#39; and `finalize&#39; function will be called(dispose will be called first and you can still ref the object in this function -- in that way, the finalize function will not be called, that&#39;s why you can `dispose&#39; many times but only `finalize&#39; once). Refer to the source code of `g_object_unref&#39; for more details.<br>
<br>&nbsp;&nbsp;&nbsp; 3. If you have pointers in your element, and I suppose you wanna free the objects which these pointers point to, right? If so, you should call `g_object_unref&#39; to these pointers in your element&#39;s finalize function.<br>
<br>Eric Zhang<br><br><div class="gmail_quote">2008/11/28 Zoltan Seress <span dir="ltr">&lt;<a href="mailto:gatesofdarkness@gmail.com">gatesofdarkness@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br clear="all">Hi Dev,<br><br>I know that this is not really a gstreamer specific question, rather GObject, so I read some GObject descriptions about finalize, but I would like to ask it nevertheless.<br>How many times is the finalize function called during the life of a plugin? It is called only once at the destruction of the Class as the pair of the class_init? Is it a problem if I have some pointers as members of my element, but I don&#39;t overwrite the finalize function? Or is it called at the destruction of an element too?<br>

Thanks!<br><font color="#888888"><br>Zoltan Seress<br>
</font><br>-------------------------------------------------------------------------<br>
This SF.Net email is sponsored by the Moblin Your Move Developer&#39;s challenge<br>
Build the coolest Linux based applications with Moblin SDK &amp; win great prizes<br>
Grand prize is a trip for two to an Open Source event anywhere in the world<br>
<a href="http://moblin-contest.org/redirect.php?banner_id=100&amp;url=/" target="_blank">http://moblin-contest.org/redirect.php?banner_id=100&amp;url=/</a><br>_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
<br></blockquote></div><br>