Use of FASTMM, Fastcode and Fastmove (illustrated)

Source: Internet
Author: User

FASTMM is a fast memory manager that replaces the Embarcadero Delphi Win32 application, and can be used under multiple threads, not prone to memory fragmentation, and can support shared memory without using external DLL files.

How to use:
1. For IDE acceleration
After extracting, the "BorlndMM.dll" under the folder ".../fastmm/replacement borlndmm dll/delphi/precompiled/for Delphi ide/performance" Copy to the ".../borland/delphi7/bin" in the Delphi installation directory to overwrite the installation (preferably backed up first).
2. Acceleration for Applications
Open the Delphi IDE and add the folder ".../fastmm" to the "Library" under "Environment Options". Then in the specific project project, in the menu bar → "Project" → "View Source", the "Fastmm4.pas" unit is added to the first position under "uses". If you need memory report message in Chinese, the file ".../fastmm/translations/chinese (Simplified)/fastmm4messages.pas" Replace file ".../fastmm/ Fastmm4messages.pas "can.

Test the memory leak report below:
1) Create a new Delphi application and add the "Fastmm4.pas" unit to the first position under "uses" in the project file;
2) Add a button, click the event as follows:

1
2
3
4
5
6
Procedure Tform1.btn1click (Sender:tobject);
Var
Sl:tstrings;
Begin
SL: = Tstringlist.create;
End

3) Run the program, click the button, exit the program and observe the results as shown:

From above you can see that there is a reported memory leak, and prompt tstringlist. Leaks, reminding you to get detailed memory leak information, you need to turn on the "Fulldebugmode" and "logmemoryleakdetailtofile" conditional compilation switches. Open the file ".../fastmm/fastmm4options.inc" and add the following code at the end of the file:

{Express Configuration Release version and debug version} 
{$ifdef  release} 
  {Release version please set} 
  {$undef  fulldebugmode} 
  {$undef   checkheapforcorruption} 
  {$define  asmversion} 
  {$undef   enablememoryleakreporting} 
  {$undef  useoutputdebugstring} 
{$else} 
  {Debug Version please set} 
  {$define  fulldebugmode} 
  {$define   enablememoryleakreporting} 
  {$define  useoutputdebugstring} 
{$endif} 

Copy the file ".../fastmm/fulldebugmode Dll/precompiled/fastmm_fulldebugmode.dll" to the project executable directory, run the program, click the button, and observe the results as shown:

In the project directory, there is a log file "Project1_memorymanager_eventlog.txt" that records the memory leak details as shown in:

If the release version, turn off debug mode, in the menu bar → "Project" → "Options" → "directories/conditionals" → "conditionals", define a conditional compilation "Release", as shown in:

Run the program again, click the button, observe the results, there is no memory leak report prompt box. Note that only the debugger in the IDE checks for memory leaks, and if you want to detect memory leaks when running programs out of the IDE, close the option {$define requiredebuggerpresenceforleakreporting}, which is turned on by default.

Fastcode provides a highly optimized function for the Delphi community, which is faster than the Delphi run-Time library functions, VCL functions, and their extension functions. Fastmove replaces all System.move calls because it has a faster speed.

How to use:
After unpacking, place the Fastmove in the Fastcode folder so that you simply reference an environment path and add ".../fastcode" to the "Library" under environment Options. Then in the specific Project project, under the menu bar → "Project" → "View Source", add the "Fastcode.pas" and "Fastmove.pas" units to the first position under "uses", as follows:

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
Program Project1;

Uses
FastMM4, {if there is fastmm, put it in the first place}
Fastcode,
Fastmove,
Forms,
Unit1 in ' Unit1.pas ' {Form1};

{$R *.res}

Begin
Application.initialize;
Application.createform (TForm1, Form1);
Application.Run;
End.

If FASTMM and fastmove are used simultaneously, you need to disable one of the conditional compilations, open the file ".../fastmm/fastmm4options.inc", and press Ctrl+f to find the string "$define Usecustomvariablesizemoveroutines ", locate the following line to read as follows:

{. $define usecustomvariablesizemoveroutines}

Using Fastmove code allows the entire program to use a faster memory move function than just a memory manager. It is therefore recommended that you combine the FASTMM and Fastmove code and turn off this option.

FASTMM, Fastcode, fastmove package Download: http://download.csdn.net/source/3337016

Extended Data:
Use FASTMM4 with view CPU in 1.Delphi to avoid memory leaks http://www.cnblogs.com/kongchao/archive/2009/10/27/1590479.html
2.FastMM Use http://blog.csdn.net/shuaihj/archive/2011/03/17/6256723.aspx

http://blog.csdn.net/akof1314/article/details/6524767

Use of FASTMM, Fastcode and Fastmove (illustrated)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.