Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2010-11

Re: memleak in fpdoc

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Vincent Snijders

2010/11/5 Michael Van Canneyt :

Show quoted text 10 lines
On Fri, 5 Nov 2010, Vincent Snijders wrote: > Hi, > > I am trying to fix the memleaks in fpdoc. Attached is a patch for > pascal parser package. > > There are still more leaks, but that is for another time.

I debugged some more. In procedure
ProcessInheritanceStrings(inhInfo:TStringList) the inhclass string list is created, but not freed. The trivial patch below fixes that. Another problem is the line:

   if not assigned(CreateAliasType(alname,clname,cls,cls2)) then

The return value of CreateAliasType doesn't seem to be freed/released. I don't know how to fix that.

Vincent

Index: utils/fpdoc/dglobals.pp
===================================================================
--- utils/fpdoc/dglobals.pp     (revision 16307)
+++ utils/fpdoc/dglobals.pp     (working copy)
@@ -856,7 +856,8 @@
                  cls2:=ResolveAndLinkClass(clname,j=0,cls);
              end;
          end;
-end;
+     inhclass.free;
+   end;
   var
     s, Name: String;

Reply by email

Michael Van Canneyt
to Vincent Snijders
Vincent Snijders wrote 19 lines
2010/11/5 Michael Van Canneyt : > > > On Fri, 5 Nov 2010, Vincent Snijders wrote: > >> Hi, >> >> I am trying to fix the memleaks in fpdoc. Attached is a patch for >> pascal parser package. >> >> There are still more leaks, but that is for another time. I debugged some more. In procedure ProcessInheritanceStrings(inhInfo:TStringList) the inhclass string list is created, but not freed. The trivial patch below fixes that. Another problem is the line: if not assigned(CreateAliasType(alname,clname,cls,cls2)) then The return value of CreateAliasType doesn't seem to be freed/released. I don't know how to fix that.
It should be freed, because it is added to the list of declarations:
   module.interfacesection.Declarations.Add(Result);

Removing

     cl2.addref;

in CreateAliasType should do it.

Michael.

Show quoted text 21 lines
Vincent Index: utils/fpdoc/dglobals.pp =================================================================== --- utils/fpdoc/dglobals.pp (revision 16307) +++ utils/fpdoc/dglobals.pp (working copy) @@ -856,7 +856,8 @@ cls2:=ResolveAndLinkClass(clname,j=0,cls); end; end; -end; + inhclass.free; + end; var s, Name: String; _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Marco van de Voort
to Michael Van Canneyt

In our previous episode, Michael Van Canneyt said:

Show quoted text 6 lines
> if not assigned(CreateAliasType(alname,clname,cls,cls2)) then > The return value of CreateAliasType doesn't seem to be freed/released. > I don't know how to fix that. It should be freed, because it is added to the list of declarations: module.interfacesection.Declarations.Add(Result);

That line was added by me yesterday in response to the same mail.

Reply by email

Michael Van Canneyt
to Marco van de Voort
Marco van de Voort wrote 9 lines
In our previous episode, Michael Van Canneyt said: >> if not assigned(CreateAliasType(alname,clname,cls,cls2)) then >> The return value of CreateAliasType doesn't seem to be freed/released. >> I don't know how to fix that. > > It should be freed, because it is added to the list of declarations: > module.interfacesection.Declarations.Add(Result); That line was added by me yesterday in response to the same mail.

Ah. Well, since you applied the patch, I didn't bother to look at the original code.

Did you remove the .addref or was it not necessary ?

Michael.

Reply by email

Marco van de Voort
to Michael Van Canneyt

In our previous episode, Michael Van Canneyt said:

Show quoted text 6 lines
> That line was added by me yesterday in response to the same mail. Ah. Well, since you applied the patch, I didn't bother to look at the original code. Did you remove the .addref or was it not necessary ?

I didn't. I don't know for sure.

Reply by email