现在的位置: 首页 > 综合 > 正文

怎样安装使用fastmm?

2013年10月22日 ⁄ 综合 ⁄ 共 3884字 ⁄ 字号 评论关闭

怎样安装使用fastmm?一篇英文说得很清楚。

 

Had to go to FastMM page to get FastMM4: http://sourceforge.net/projects/fastmm/

Copy FastMM4BCB.cpp, FastMM4.pas, FastMM4Message.pas, and FastMM4Options.inc to your project directory.

Add FastMM4Messages.pas first, then FastMM4.pas, then FastMM4BCB.cpp. On compiling the .pas files, .hpp files are created and imported by the subsequent files.

Then, you must add USEOBJ("FastMM4BCB.cpp") to your project file, BEFORE any other USEFORM directives. This apparently is the (completely undocumented) equivalent to the "uses" directive in Delphi.

Before compiling, you must add the following line at the beginning of FastMM4BCB.cpp, so that the _TEXT("string") macros used in that .cpp (but not defined in that file) work as intended:

if you are using UNICODE (Project/Options/Directories and Conditionals/TCHAR maps to wchar_t):
#define _TEXT(a) L##a

if you are not using UNICODE (Project/Options/Directories and Conditionals/TCHAR maps to char)
#define _TEXT(a) a

Finally, as per the instructions in FastMM4BCB.cpp, you must set Project/Options/C++ Linker/Dynamic RTL to False.

If you either fail to set Dynamic RTL to false or use the USEOBJ directive, you will get the infamous:
FastMM4 cannot be installed since another third party memory manager has already installed itself.
If you want to use FastMM4, please make sure that FastMM4.pas is the very first unit in the "uses"
section of your project's .dpr file.

You can now compile and run your program with FastMM4. You will find some memory leaks in Embarcadero's code, as indicated in the message box
shown when your application terminates.

As suggested in the message box, you can enable FullDebugMode by removing the "." in {.FullDebugMode} in FastMM4Options.inc. However, then FastMM4.pas does not compile, with
an error at line 1351 in the definition of StandardVirtualMethodNames. Googling that does not give any clue as to how to fix that problem.
So, does anyone know how to enable FastMM4 FullDebugMode in C++ Builder 2009 so we can get the leak reporting mentioned above?

Thus, the full set of instructions for getting memory leak detection working under C++ Builder 2009:

Go to FastMM page to get FastMM4: http://sourceforge.net/projects/fastmm/

Copy FastMM4BCB.cpp, FastMM4.pas, FastMM4Message.pas, FastMM4Options.inc, and FastMM_FullDebugMode.lib to your project directory.

Copy FastMM_FullDebugMode.dll to your application's .exe's directory

To your project, add FastMM4Messages.pas first, then FastMM4.pas, then FastMM4BCB.cpp to the project. On compiling the .pas files, .hpp files are created and imported by the subsequent files.

Then, you must add USEOBJ("FastMM4BCB.cpp") to your project file, BEFORE any other USEFORM directives. This apparently is the (completely undocumented) equivalent to the "uses" directive in Delphi.

Before compiling, you must add the following line at the beginning of FastMM4BCB.cpp, so that the _TEXT("string") macros used in that .cpp (but not defined in that file) work as intended:
#include <tchar.h>

Before compiling, you must comment out the check for the Delphi version (since you are not compiling with Delphi). Find the line
{$ifdef Delphi6AndUp} at about line 1337 and the matching {$endif} at about line 1343 (NOT the {$ifend} that matches {$if RTLVersion >= 20}) and comment both of those lines by adding a period:
{.$ifdef Delphi6AndUp}
{.$endif}

Finally, as per the instructions in FastMM4BCB.cpp, you must set Project/Options/C++ Linker/Dynamic RTL to False.

If you either fail to set Dynamic RTL to false or to use the USEOBJ directive, you will get the infamous:
FastMM4 cannot be installed since another third party memory manager has already installed itself.
If you want to use FastMM4, please make sure that FastMM4.pas is the very first unit in the "uses"
section of your project's .dpr file.

You can now compile and run your program with FastMM4. You will find some memory leaks in Embarcadero's code, as indicated in the message box
shown when your application terminates.

As suggested in that message box, you can enable FullDebugMode by removing the "." in {.FullDebugMode} in FastMM4Options.inc to get a text file that reports the leaks in detail
No, the Embcarcadero version has Pierre postings as of 5/23/2009.
I was suggesting you ask there as that is where he tends to hang out.
Other fastcode programmers and FastMM users also monitor the group.

Thank you for pointing me to the newsgroup. For others, this is a newsgroup on newsgroups.codegear.com with the full name embarcadero.public.delphi.language.basm

抱歉!评论已关闭.