Re: Memory leaks


  ----- Original Message ----- 
  From: Alex Bosetti 
  To: www-lib@w3.org 
  Sent: Sunday, June 24, 2001 3:57 AM
  Subject: Memory leaks


  Hi all.

  I am experiencing all sorts of memory leaks using the library under win2000.
  I have successfully compiled all the examples, but when I try to run them, all of them leak terribly.

  I can understand the robot, which has to keep track of where is gone, but the showlinks example should release all the memory when is done.
  This latest program leaks 48 byte at every run, other as much as 2048 (depending on the page visited).

  I have used latest csv.

  Compiler: VC sp6 and Bcc 5.5 (both with same result).

  Any idea?
  Could it be the way I have compiled the library ?
  Ty 
  Alex
Most likely these memory leaks are "HTAnchor" objects. Anchors just keep piling up unless you explicitly erase'em because libwww doesn't have any inherent garbage collection for this object. Use HTAnchor_delete (per anchor) or HTAnchor_deleteAll from time to time. HTML parser also seems to create a lot of empty anchors which are never visited whenever a hyperlink is parsed (with HTAnchor_findChildAndLink). I removed all the HTAnchor_findChildAndLink calls from HTML.c (so that I could create the anchor when the new URL is actually visited) and it saved a substantial amount of memory for the robot.

Received on Sunday, 24 June 2001 09:38:21 UTC