HTMViewer Memory Leak
- From: wp_xxyyzz <wp_xxyyzzz@xxxxxxx>
- Date: Tue, 14 Aug 2007 21:25:11 +0200
Hi,
the HTML viewer provided now for free by www.pbear.com for viewing of HTML documents seems to have a memory leak in the image reading code (at least in the current version 9.44).
Images are passed to the component by means of an event handler for the OnImageRequest event:
TGetImageEvent = procedure(Sender: TObject; const SRC: string;
var Stream: TMemoryStream) of Object;
The image data are passed via the TMemoryStream. The var parameter indicates that the stream has to be created by the event handler.
The source code of GetTheBitmap method where this event handler is called, however, shows that this stream is never freed. FastMM, correspondingly, complains about a memory leak.
I could resolve this problem by adding the line
if Assigned(Stream) then Stream.Free;
at the end of the "if Assigned(GetImage) then" section of the TSectionList.GetTheBitmap method (in line 6715 of Htmlsubs.pas, version 9.44, to be precise).
Hope this is useful to somebody...
.
- Follow-Ups:
- Re: HTMViewer Memory Leak
- From: wp_xxyyzz
- Re: HTMViewer Memory Leak
- From: Tim Sullivan
- Re: HTMViewer Memory Leak
- Prev by Date: Re: HTMViewer Memory Leak
- Next by Date: HTMLViewer: How to avoid the handcursor on inactive links
- Previous by thread: FastMM4 - Can't find log file???
- Next by thread: Re: HTMViewer Memory Leak
- Index(es):