Re: [fpc-pascal] Help with understanding HeapTrc output

2008-11-05 Thread dmitry boyarintsev
Graeme.

If you're using Lazarus, you'd probably be interested in using LeakView
package.

If you write out HeapTrc output into separate file, then LeakView dialog
will allow you to read the file, and present the the leaks in compact
tree-view style. Also, it will allow you to quick jump by double-clicking.
to the line, causing the leak .

You can write out HeapTrc into separate file in two ways:

1) if your project uses HeapTrc unit, then you can specify file name by
using procedure SetHeapTraceOutput(filename);

2) if you're using -gh compiler option, then you should specify environment
variable, IIRC: HEAPTRC:log=filename

LeakView has been included in Lazarus Package list, so the only thing you
need is to rebuild IDE with the package included.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Help with understanding HeapTrc output

2008-11-05 Thread Graeme Geldenhuys
On 11/5/08, dmitry boyarintsev [EMAIL PROTECTED] wrote:

 If you're using Lazarus, you'd probably be interested in using LeakView
 package.

I started using it 10 minutes after it was committed to trunk. :-)
LeakView is very handy indeed!

One small suggestion though. Can you include the summary information
in that dialog as well? By summary information I mean the following...

Heap dump by heaptrc unit
21345 memory blocks allocated : 921443/1006336
21345 memory blocks freed : 921443/1006336
0 unfreed memory blocks : 0
True heap size : 655360
True free heap : 655360


I'm mainly interested in the number of unfreed memory blocks.


Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Help with understanding HeapTrc output

2008-11-04 Thread Graeme Geldenhuys
On Mon, Nov 3, 2008 at 8:17 PM, Jonas Maebe [EMAIL PROTECTED] wrote:
 3)  I should trace the information from the bottom line to the top line...

 It's a backtrace, like when an exception or run time error occurs. The top
 line is the actual place where the allocation happened, the next is the
 caller of that place, etc.

Perfect, that's what I wanted to confirm.

 4) Why does it quote more than one line?  If I allocated memory on a
 specific line, should just that line be quoted?

 I don't understand what you mean with quote more than one line. However,
 things like this:

JoshyFun's explanation helped here. It's the code path (sequence)
leading up to the 'allocate memory' call.


Thanks both to Jonas and JoshyFun for helping out. Incidently, my
application is now leak-free. :-)

I also made a note to self:
  Enabled heaptrc unit for all projects while I develop! It's easier
to trace the problem just after you caused it, than to try and hunt it
down weeks later.

Thanks guys!

Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Help with understanding HeapTrc output

2008-11-03 Thread Jonas Maebe


On 03 Nov 2008, at 15:10, Graeme Geldenhuys wrote:


1)  Every Call trace for block is a memory leak, correct?


Yes.


2)  Each Call trace for block is where the memory was allocated
(start being used)?


Allocated.

3)  I should trace the information from the bottom line to the top  
line...


It's a backtrace, like when an exception or run time error occurs. The  
top line is the actual place where the allocation happened, the next  
is the caller of that place, etc.



4) Why does it quote more than one line?  If I allocated memory on a
specific line, should just that line be quoted?


I don't understand what you mean with quote more than one line.  
However, things like this:



 $080AD78F  MAINPROC,  line 104 of tutoradmin.lpr
 $080B6127  MAINPROC,  line 104 of tutoradmin.lpr
 $0809849B  TCUSTOMLISTMEDIATOR__CREATESUBMEDIATORS,  line 1122 of
/home/graemeg/programming/3rdParty/tiOPF2/Source/Core/ 
tiBaseMediator.pas


usually mean that no line (debug) information was available for the  
two first addresses.



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


Re: [fpc-pascal] Help with understanding HeapTrc output

2008-11-03 Thread JoshyFun
Hello Graeme,

Monday, November 3, 2008, 3:10:49 PM, you wrote:

GG 1)  Every Call trace for block is a memory leak, correct?

Yes, but take care, two strings in a non freed object (in example)
will produce three memory blocks. 1 for the object and one for each
string.

GG 2)  Each Call trace for block is where the memory was allocated
GG (start being used)?

Where it has been allocated or reallocated (it could be used somehow
later, or never).

GG 3)  I should trace the information from the bottom line to the top line...

To follow the sequence yes.

GG 4) Why does it quote more than one line?  If I allocated memory on a
GG specific line, should just that line be quoted?

You may allocate a memory block in the same line following different
paths, finally all memory blocks are a GetMem so if only one line is
quoted you will only see GetMem procedure.

-- 
Best regards,
 JoshyFun

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