gthread memory allocation error

Thiago Macieira thiago at kde.org
Sun Nov 2 23:49:46 PST 2008


knightmanish wrote:
>//frees the array position to be used by another thread
>free_array[count].status=1;
>
>//frees the memory
>GThread* thread = ?g_thread_self();
>g_free(thread);
>return NULL;
>}
>
>Am I missing some memory freeing function to be called OR something
>necessary??

I believe you'll have to ask a glib mailing list about the code sections 
above. I don't know glib, but most other thread implementations I know 
won't let you delete the thread object while the thread is running, much 
less from inside the thread.

Also note that your free_array should be volatile. You're accessing it 
from two different threads without a lock.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20081103/87cccb22/attachment.pgp 


More information about the dbus mailing list