Hi Experts, I have my app fitted with FastMM4 to show me the memory leaks... and I've got one that's really stumping me. Basically I enter a procedure where I declare one local instance of a variable of type TCSVBasicRecord. Let's call this instance "NewItem". TCSVBasicRecord is previously declared globally in my app as such:
type TCSVBasicRecord = class(TObject)
Fields: TStringList; // de-quoted
OriginalTexts: TStringList; // including quotes/double quotes
Destructor Destroy; override;
Class Function CreateFromFileText(var AllText: string; delimiter_: char; quoteChar_: char; endOfRecordIndicator: string): TCSVBasicRecord;
(the Function CreateFromFileText does a bunch of string manipulations and basically parses a string according to CSV convention... that's not the problem)
OK, in my procedure I've got a TRY...EXCEPT block within a While loop that does the bulk of the work. When data is clean and everything works good and no exceptions are thrown, everything gets freed and tidied up nicely and no memory leaks are reported when I exit my app. But when I run a test with erroneous data that triggers an exception and enters the EXCEPT block, I get a stupid memory leak. In my EXCEPT block, I show an error message and then terminate the app, but just before doing so, I make sure to perform the exact same free-ing of objects and closing of files that I do when the app runs successfully. So I'm just baffled by this... any thought anyone please?