Hi!
I'm making a memory manager that does bookeeping of callings to getmen and freemem (and their variants) to have a rough idea that a program has no memory leaks.
In my testings i have an strange result, and i do not know why.
If a procedure (or function) uses a string internally and calls other procedure (not in the same unit) using the string, that string doesn't call freemem
Example:
Compiler uses freemem for s3;
procedure SumStrings (s1,s2:string);
Var
s3:string;
begin
s3:=s1+s2;
writeln (s3);
end;
{compiler do it ok}
Compiler doesn't seems to use freemen for s3 after ending procedure.
procedure SumStrings (s1,s2:string);
Var
s3:string;
begin
s3:=s1+s2;
writeln (s3);
{AnotherProcedure belongs to other unit}
AnotherProcedure (s3); {s3 is not removed with freemem, perhaps compiler does it other way}
end;
(Note: updated post..).