Hi, I'm using FastMM4 in my project and during runtime, it throws off this error:
"FastMM has detected a FreeMem call after FastMM was uninstalled"
I don't use any "Freemem" calls in my code, but I do a "Dispose" in one of my functions which gets called repeatedly from within a loop:
function PhoneNumMask(const Str: string; const hmask: string): PChar;
Pstr, Pmask, ResultStr: PChar;
Pstr := PChar(Str);
Pmask := PChar(hmask);
while Pmask^ <> #0 do
if Pmask^ <> '#' then // a literal character in the mask, output it directly
else // output a digit
while (PStr^ <> #0) and not (PStr^ in ['0'..'9']) do
if PStr^ = #0 then BREAK; // Exit loop
StrCat(ResultStr,PChar(string(PStr^))); // Tack on a digit to the result string
end; // while Pmask^ <> #0 do
end; // PhoneNumMask
... I prepare a new PChar variable "ResultStr" with the NEW command, then do a DISPOSE of it at the end. I can't see the problem. My app processes text files on disk and I ran a test on a 20 meg file and it went about 5% though the data, and only then gave the error. So the error didn't happen immediately... it took a lot of iterations before it happened.
Maybe I don't even *need* variable "ResultStr" and I can just assign my function's result to the default "Result"....