W3C home > Mailing lists > Public > www-lib@w3.org > July to September 2002

Re: Memory leaks

From: Alex Woo-Hyun Kim <woorung@empal.com>
Date: Mon, 30 Sep 2002 06:55:04 -0400 (EDT)
Message-ID: <3D982DDD.90703@empal.com>
To: www-lib@w3.org




There are some memory leaks in showlinks.c.
You can rewrite as followings :

-------------------------------------------------------
PRIVATE int terminate_handler (HTRequest * request, HTResponse * 
response,void * param, int status)
{
    /* We are done with this request */
    HTRequest_delete(request);

    /* Terminate libwww */
    HTProfile_delete();

    /* rewritten by woorung */
    //exit(0);
    HTEventList_stopLoop();
    return 0;
}
--------------------------------------------------------
int main(int argc,char *argv[])
{
    ...........

    if (uri) {
        HTRequest * request = NULL;
        HTAnchor * anchor = NULL;
        BOOL status = NO;

        /* Create a request */
        request = HTRequest_new();

        /* Get an anchor object for the URI */
        anchor = HTAnchor_findAddress(uri);

        /* inserted by woorung */
        printf("escape : [%s]\n",uri);

        /* Issue the GET and store the result in a chunk */
        status = HTLoadAnchor(anchor, request);

        /* Go into the event loop... */
        if (status == YES) HTEventList_loop(request);

        /* inserted by woorung to keep from leaking of memory */
        HTAnchor_deleteAll(NULL);
    }

    ...........
} 
Received on Monday, 30 September 2002 07:03:51 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:42 GMT