Hi everyone-

I'm evaluating using libevent on a project I'm working on. I'm having
some issues with my test program using evhttp. It seems to leak
memory.  I'm feeding it 100 requests per second.  Using ps I can see
its memory usage continually grow, until it crashes from not being
able to malloc/calloc/etc.. I ran my app in valgrind, it didn't find
any lost blocks.

I'm stumped.  Perhaps I'm forgetting to free some resource using the
api? Not sure what's going on. Below is the pseudo-ish code for my
app.  Any insight would be *greatly* appreciated.

I'm running libevent-1.3e on Debian sarge with a 2.4 kernel.

main()
{
        httpd = evhttp_start("0.0.0.0",8080);
        evhttp_set_timeout(httpd, 5);
        evhttp_set_cb(httpd, "/log", log, NULL);
        event_dispatch();
}

and in log()-
void log(struct evhttp_request* req, void* arg)
{
        char msg[] = "This is a test";
        evbuffer* buf = evbuffer_new();
        if (buf)
        {
                evbuffer_add(buf, msg, strlen(msg));
                evhttp_send_reply(req, HTTP_OK, "OK", buf);
                evhttp_send_reply_end(req);
                evbuffer_free(buf);
        }
}
_______________________________________________
Libevent-users mailing list
[email protected]
http://monkey.org/mailman/listinfo/libevent-users

Reply via email to