libpurple for non-gui clients

Kyryll A Mirnenko aka Mirya mirya at
Fri Aug 10 09:33:23 EDT 2007

On Thursday 09 August 2007 15:46, you wrote:
> On Thu, Aug 09, 2007 at 03:18:44PM +0300, Kyryll A Mirnenko aka Mirya wrote:
> > There's some sort of a problem using libpurple for non-ui clients: it
> > creates a conversation for every little talk. If a non-ui client handles
> > lots of news users it becomes a hazard.
> By "hazard", do you mean "uses a tonne of memory"?  A PurpleConversation
> is 44 bytes, a PurpleConvIm is 24 more, and the strings and hash tables
> inside add up to, for one I have open now, about 150 more bytes.
> Conservatively, four thousand conversations is about a megabyte of
> memory.
Anyway I need to clean them up sometime.

> The crash is presumably because write_conv is being called from some
> function which will use the PurpleConversation struct again before
> returning.  You could use an idle callback as follows:
>     static gboolean
>     idle_destroy_conversation_cb (gpointer data)
>     {
>         PurpleConversation *conv = (PurpleConversation *)data;
>         purple_conversation_destroy (conv);
>         return FALSE; /* don't keep calling this */
>     }
>     /* ... code scrolls by for a while ... */
>     /* meanwhile, in your write_conv callback: */
>         g_idle_add (idle_destroy_conversation_cb, conv);
There's a little problem with that idea: if conversation was used twice, it 
will try to free it twice. Some tracking must be added, not so simple as 
someone maight consider
Regards, Mirya
ICQ #313898202

More information about the Devel mailing list