Re: [fpc-devel] memleak in fpdoc

2010-11-07 Thread Michael Van Canneyt



On Sat, 6 Nov 2010, Vincent Snijders wrote:


2010/11/5 Michael Van Canneyt mich...@freepascal.org:



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.



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  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] memleak in fpdoc

2010-11-07 Thread Marco van de Voort
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.
 
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] memleak in fpdoc

2010-11-07 Thread Michael Van Canneyt



On Sun, 7 Nov 2010, Marco van de Voort wrote:


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.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] memleak in fpdoc

2010-11-07 Thread Marco van de Voort
In our previous episode, Michael Van Canneyt said:
  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.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] memleak in fpdoc

2010-11-06 Thread Vincent Snijders
2010/11/5 Michael Van Canneyt mich...@freepascal.org:


 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;
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel