BPSoftware.com
Home   Utilities   Purchase   FAQ   Support   Contact        
Shareware Utilities
 APrintDirect
 AIconExtract
 AFile Attribute Manager
Freeware Utilities
 AddrMon
 AFileSync
 ASysIcon
 B&P Table Utilities
 BPACLer
 BPSNMPMon
 BPSNMPUtil
 CharCount
 Delphi® Components
 MacAddr
Miscellaneous
 BPSoftware Blog
 Purchase Shareware
 Support

 Subscribe!

Sunday, November 06, 2005
FASTMM Saves the Day

Back in October, Borland® announced a new version of Delphi®. ‘Delphi 2006’, codename Dexter, looks like it is going to contain a number of significant fixes and enhancements. These enhancements look like they will greatly enhance Delphi®’s rapid application development (RAD) environment.

FASTMM is an opensource replacement memory manager for Borland® Delphi® (Thanks Pierre for an excellent project!). Not only does it noticeably increase speed, but it also assists with the debugging and logging of memory leaks. FASTMM discussions have been circulating for a while. Discussions about and attention to FASTMM have recently increased with the indications that FASTMM will be included in the next Delphi® release.

My curiosity was peaked, and I started working with FASTMM over the past week. I must admit that I am impressed. I am also excited to see how it will integrate with the newest release of Delphi®. I started working with some small applications to get the feel for its usage and functionality. In one of my tests I dropped a TShellComboBox, TShellListView and TShellListView from the Samples palette onto a TForm and ran the application. Much to my surprise, I received FASTMM notification of memory leaks when I closed the application. Considering I hadn’t written one line of code, I must admit I was skeptical of the leak. In order to give myself piece of mind (and boost confidence in FASTMM) I decided to look through ShellCtrls.pas to see if anything stood out. I also searched the web and QualityCentral (QC) to see if there were any fixes or posts discussing memory leaks with theses sample controls. I did find some old posts and fixes, however none related to my situation.

In reviewing ShellCtrls.pas I did notice a few things that potentially validated the memory leaks noted by FASTMM. I changed some code (listed below), recompiled and reran my sample application. I was pleasantly surprised to see that the dialog box (that causes your heart to drop) displaying memory leak information no longer appeared. I consider this my indoctrination to using FASTMM. Thus far I am very pleased with it and look forward to the continued use of this excellent memory manager.

The changes I made to ShellCtrls.pas:

In TCustomShellTreeView add:
public
destructor Destroy; override;

destructor TCustomShellTreeView.Destroy;
begin
if
Assigned(FRootFolder) then
FRootFolder.Free;
inherited;
end;



In TCustomShellListView change:
destructor TCustomShellListView.Destroy;
begin
ClearItems;
FFolders.Free;
inherited;
end;


to

destructor TCustomShellListView.Destroy;
begin
ClearItems;
FFolders.Free;
if Assigned(FRootFolder) then
FRootFolder.Free;
inherited;
end;



In TCustomShellComboBox change:

destructor TCustomShellComboBox.Destroy;
begin
inherited Destroy;
if Assigned(FImageList) then FImageList.Free;
end;

to

destructor TCustomShellComboBox.Destroy;
var
i: integer;
begin
for i := 0 to Items.Count - 1 do
if Assigned(Folders[i]) then Folders[I].Free;
if assigned(FRootFolder) then FRootFolder.Free;

inherited Destroy;
if Assigned(FImageList) then FImageList.Free;
end;

Labels: , , ,

posted by Brad Prendergast at 9:11:00 PM (2 comments)
Links to this post
Permalink
Recent Posts
 SQL: DBCC CHECKTABLE on multiple tables
 SQL: Index Fragmentation Maintenance
 Off-topic: Uhm, Rickroll?
 SQL: Where are the database files?
 Show Desktop in my QuickLaunch Toolbar?
 Command Line: Visual Source Safe
 SQL: Remove / Delete Orphan Users
 SQL Delete/Drop a User from each Database
 Is there an 'I' in phone?
 SQL Optimization: Am I missing any indexes? - Part...

 Subscribe!


Labels



Archives
 October 2005
 November 2005
 December 2005
 January 2006
 February 2006
 March 2006
 April 2006
 May 2006
 June 2006
 July 2006
 August 2006
 September 2006
 December 2006
 January 2007
 February 2007
 March 2007
 September 2007
 October 2007
 November 2007
 July 2008
 November 2008
Powered by Blogger