I've tried it on the 0.39-6. It still fails, but not by
sigsegv. It just hangs on accept() at some moment (when
memory size reaches its limit)

Anyway, here is the bug:

----------src/chm_http.c------------
static void chmhttp_server(const char *filename)
{
    ...
    pthread_t                   tid;
    ...
    while(1)
    {
        ...
        pthread_create(&tid, NULL, _slave, (void *)slave);
    }
    ...
}
------------------------------------

threads are not joined. when I inserted pthread_join() just
after the thread_create(), the leak disappeared.

So to fix it, one should maintain spawned threads and join
them as needed. Or, probably, just forget about it and
merely call _slave() - I think it is OK for this specific
application: data is taken from archive only, and there is
no reason for any significant delay.

Moreover, I've heard thread creation is rather expensive on
Linux, and by quick benchmark I saw that thread-less version
works several times faster than threaded (on wget -r).

So, I suggest removing the threads.

-- 
Max



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to