Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/VCL/Additional Controls/Action Bar Controls/TActionManager    [ Add a report in this area ]  
Report #:  31683   Status: Closed
ActionManager Memory issue with FastMM4 installed
Project:  Delphi Build #:  10.0.2288.42451
Version:    10.0 Submitted By:   Jeremy North
Report Type:  Basic functionality failure Date Reported:  7/24/2006 6:11:50 PM
Severity:    Commonly encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   244036
Resolution: Fixed (Resolution Comments) Resolved in Build: : 12.0.3101.14581
Duplicate of:  None
Voting and Rating
Overall Rating: (5 Total Ratings)
5.00 out of 5
Total Votes: 12
Description
When using full debug mode with FastMM4 installed (from sourceforge)
there is an error in the Action Manager control.

It is easy to reproduce but does require downloading and configuring
fastmm (http://fastmm.sourceforge.net)


I consider this a serious bug because I can not use the FullDebug capabilities of FastMM until this issue is resolved.
Steps to Reproduce:
1. Open the WordPad demo in the ActionBands folder under demos (for
win32)
2. Add FastMM4 to the project file. It must be the first file in the
uses clause
3. Set the FileName property of the TActionManager control to some
valid location (file will be created). Example "c:\toolbars.dat"
4. Run application
5. Close application
6. Run application again (this will then load the toolbars saved in the
toolbars.dat file)
7. Shutdown application

If you have FastMM configured correctly you will get a memory error
when freeing FDefaultActionBars in the destructor of TActionManager
(sorry I didn't debug further into this).

Make sure you copy the FastMM_FullDebugMode.dll to the same folder that
has the executable or to a folder on your path variable (so it can be
found).

Turn FullDebugMode on in the FastMM4Options.inc file.
Workarounds
Copy the ActnMan.pas file into your project folder and make the following change to the TCustomActionManager.Destroy method.

This is probably not the most elegant way to solve this issue, but it works and I've got better things to be doing.

destructor TCustomActionManager.Destroy;
var
  i: Integer;
begin
  FPrioritySchedule.Free;
  FActionBars.Free;
  if FDefaultActionBars <> nil then
  begin
    for i := 0 to FDefaultActionBars.Count - 1 do
      FDefaultActionBars.GetActionBar(i).FActionBar := nil;
    FDefaultActionBars.Free;
  end;
  if Assigned(FLinkedActionLists) then
    FLinkedActionLists.Free;
  inherited Destroy;
end;

NOTE: You will not be able to distribute your application with runtime packages with this change included.
Attachment
JED5B4.zip
Comments

Steve Bernard at 7/24/2006 8:21:13 PM -
Porting to D2006 from D6 gave me the same problem.
Multiple AVs on closing application using actionbands when storing to toolbar.dat.
When I clear the filename property = all works.
Busy changing to TMS toolbar.

Uwe Molzahn at 8/12/2006 9:35:21 AM -
The same memory leaks also appear when using the ActionManager's LoadFromStream and SaveToStream methods instead of its File property.

Using D7 Pro

Roddy Pratt at 1/11/2007 9:31:11 AM -
I can repeat htis problem - I've uploaded an attachment showing the fastmm error dialog.

Server Response from: ETNACODE01