Solved

THyperparse memory leak

Posted on 2003-12-09
2
235 Views
Last Modified: 2010-04-05
hi!

I'm using THyperParse to parse HTML files and extract information. Now the problem is that it has a memory leak: creating and destroying 100 objects takes up to ~50MB of memory when the file is large enough; according to the task manager.

Of course I could use another component (though hard to find a free one which is right for me), but time is pressing and I can't migrate the whole project just now.
Before you ask, yes I've asked the author, but he can't help me right now, because he's no time.

I've created a sample app which you can download from
http://www.hds-pad.de/dld/hyperparse-memory.zip  (which includes the component, as well).

This is quite important. If you find a solution I'll raise the # of points!


thanks a lot!
0
Comment
Question by:webers
2 Comments
 
LVL 26

Accepted Solution

by:
Russell Libby earned 250 total points
ID: 9906308

Well, looking at the source code posted (which doesn't seem to quite match your project, ie Execute doesn't take any params, but your code is passing a string), the
THtmlInfo object does not cleanup its item list when the destructor is run

Should be something like...

destructor THtmlInfo.Destroy;
var  dwIndex:    Integer;
begin

  // *** Addition ***
  for dwIndex:=Pred(FParamList.Count) downto 0 do
  begin
     Dispose(PHtmlParameter(FParamList[dwIndex]));
  end;
  // *** End of addition ***

  FParamList.Free;

  inherited Destroy;

end;

Regards,
Russell
0
 

Author Comment

by:webers
ID: 9938654
lovely, I didn't know it's that simple.
(well, I don't have much of a clue of memory programming)

thanks a lot.
Heiko.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now