W3C home > Mailing lists > Public > www-lib@w3.org > April to June 2001

Re: POST timers and temporary anchors

From: Michel Philip <philipm@altern.org>
Date: Sun, 29 Apr 2001 22:25:19 +0200
Message-ID: <3AEC78AF.D02EB598@altern.org>
To: www-lib@w3.org
Hi Attila,

> From: Attila Uhljar (attila.uhljar@intervoice-brite.com)
> Date: Thu, Apr 26 2001

> I've got a questions regarding POST (again.. :) 
> In the HTTP.c [...]
>

Sorry, I don't know yet POST requests.

> [...]
> Another thing. 
> When doing lots of POSTs, I get memory leak. 
> It seems that it is caused by the HTAnchor objects [...]

Initially I went into libwww sources
because of a memory leak too.
 (I say initially 'cause with tests it rather becomes crashes,
 core dumps or infinite loops ;-(

> [...] (all different, thus require different anchors) 

Different or not it makes no... difference.
Anchors are not deleted.
However with POST, for the few I've watched, 
maybe you'd better focus on links.

> [...]
> Since Anchors linger around forever 
> (or at least 'till the library gets terminated), 
> this causes a leak (for me, at least :)

I have memory leak just by doing GET because anchors are never made free.

> Does anybody have any idea when and where is best to free these anchors? 

I believe I've some idea about this.

> I guess the application could do it, but I'd rather do it in libwww.

It's hardly easy to do it in the libwww (at least for my little brain).

I've first tried a crazy patch such I can call HTAnchor_delete without
crashing while there is running requests. 
I didn't crash anymore but I still got memory leak.

I did tests with the standard wwwlib. 
What I've understood is :

In the HTAnchor.c file there are HTAnchor_delete and HTAnchor_deleteAll.

For, HTAnchor_deleteAll I believe 
you *must* call it only when all the requests are *done*.
If not, you can cash .

With HTAnchor_delete(oneAnchor), 
if you don't crash, 
even if you wait for all the requests to be done
before calling this function
in any case you will still have memory leak !!

If you need it, try to understand it.
I suggest that you quickly decide to rewrite it from scratch.

With HTAnchor_deleteAll, as far I've tested it seems 
that there is no memory leak.
(or maybe so small I've not seen yet it ;-)

Call it in your terminate_handler for instance.

One again, don't use HTAnchor_deleteAll(doc_or_null)
when you have pending (GET) requests. 
It can crash also.
I guess a PB which would be a HTRequest one
rather than an HTAnchor oene,
when using multiple requests.

Hope this help.

Michel.

P.S.

As for my application, it's simple, there is always 
(theatrically) pending request(s). ;-(
Received on Sunday, 29 April 2001 16:25:30 GMT

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