Using dfSplat to identify object leaks: Difference between revisions

From DataFlex Wiki
Jump to navigationJump to search
(Created page with "=== Preface === One of the problems when developing a program which has a lot of dynamic objects is that you make sure that all the objects that are created are also destroyed...")
 
(2 intermediate revisions by the same user not shown)
Line 46: Line 46:
Next up we are going to run this little program with dfSplat.
Next up we are going to run this little program with dfSplat.


Start dfSplat, then from the toolbar menu select the "Start Debug" button. This will open a "File Open" dialog and you can navigate to the program's folder of your workspace and select the LeakyObjects.exe application.
Start dfSplat, then from the toolbar menu select the "Start Debug" button. [[File:dfSplat-LeakyObjects-Start-debug.png]]
 
This will open a "File Open" dialog and you can navigate to the program's folder of your workspace and select the LeakyObjects.exe application.


Now the program will run in the dfSplat debugger and the input from the last line of the program will popup.
Now the program will run in the dfSplat debugger and the input from the last line of the program will popup.
Line 52: Line 54:
=== Set the breakpoints ===
=== Set the breakpoints ===
Click back on dfSplat and from the toolbar select "Open Source File", in the "File Open" dialog you get now, navigate to the AppSrc folder of your workspace and select "LeakyObjects.src" and click on the "Open" button.
Click back on dfSplat and from the toolbar select "Open Source File", in the "File Open" dialog you get now, navigate to the AppSrc folder of your workspace and select "LeakyObjects.src" and click on the "Open" button.
[[File:dfSplat-LeakyObjects-Open-Source-File.png]]


The source file now shows in the edit window.
The source file now shows in the edit window.
Line 60: Line 64:


Set the breakpoints like this.
Set the breakpoints like this.
[[File:dfSplat-LeakyObjects-Set-Breakpoints.png]]


=== Debug for leaky objects ===
=== Debug for leaky objects ===
Click the Restart Debug button from the toolbar.
Click the Restart Debug button from the toolbar.
[[File:dfSplat-LeakyObjects-Restart-Debug.png]]


Your program will stop at the first breakpoint.
Your program will stop at the first breakpoint.
[[File:dfSplat-LeakyObjects-Stop-at-First-Breakpoint.png]]


Let's have a look at all the objects that are currently in your program.
Let's have a look at all the objects that are currently in your program.


From the Tools menu, select "Object Inspector", you'll see the following dialog:
From the Tools menu, select "Object Inspector", you'll see the following dialog:
[[File:dfSplat-LeakyObjects-Object-Inspector-first-stop.png]]


At this stage we only have a FormFloatingMenu object that is defined somewhere in the Winbase.pkg file that we are pulling in.
At this stage we only have a FormFloatingMenu object that is defined somewhere in the Winbase.pkg file that we are pulling in.


Close the Object Inspector and run the program (F5) again, we are now at the 2nd breakpoint. Open the Object Inspector again.
Close the Object Inspector and run the program (F5) again, we are now at the 2nd breakpoint. Open the Object Inspector again.
[[File:dfSplat-LeakyObjects-Object-Inspector-Second-stop.png]]


As you can see now, our 20 test objects have been created.
As you can see now, our 20 test objects have been created.
Line 82: Line 96:
Re-open the Object Inspector:
Re-open the Object Inspector:


Here you can see WHY the object inspector is an interesting tool to have.
[[File:dfSplat-LeakyObjects-Object-Inspector-Last-Stop.png]]
 
Here you can see one of the reasons on WHY the object inspector is an interesting tool to have.


The objects that got destroyed are no longer listed, but the ones we "forgot" to destroy are still visible.
The objects that got destroyed are no longer listed, but the ones we "forgot" to destroy are still visible.

Navigation menu