官术网_书友最值得收藏!

ScaleMM

First such memory manager is ScaleMM. It is the work of André Mussche and can be downloaded from https://github.com/andremussche/scalemm. You can use it in practically any application, as it is released under a tri-license MPL 1.1/GPL 2.0/LGPL 2.1. It only supports the Windows platform.

ScaleMM is written in Delphi and assembler. To use ScaleMM, you just have to download it, store it somewhere on the disk and add the ScaleMM2 unit as a first unit in the program.

ScaleMM was created as a faster replacement for FastMM. It is not as loaded with debugging features as FastMM but implements just a base memory manager functionality. Because of that, it makes sense to run FastMM while debugging, and ScaleMM while testing and in production.

The older version of Delphi didn't like it if you put the {$IFDEF} directive inside the main program's uses list. Delphi will remove this directive when you add a new form to the program. The easiest way to fix this is to create a new unit and add it as a first unit in the main program's uses list. In this new unit, you can then put {$IFDEF} in the used memory manager however you wish.

An example of the uses list in such a main program is shown here:

program ParallelAllocation;

uses
ParallelAllocationMM,
Vcl.Forms,
ParallelAllocationMain in 'ParallelAllocationMain.pas' {frmParallelAllocation};

Unit ParallelAllocationMM can then be implemented as shown here:

unit ParallelAllocationMM;

interface

uses
{$IFDEF DEBUG}
FastMM4 in 'FastMM\FastMM4.pas';
{$ELSE}
ScaleMM2 in 'ScaleMM\ScaleMM2.pas';
{$ENDIF}

implementation

end.

Replacing FastMM with ScaleMM in the test program, ParallelAllocation shows a noticeable improvement. With FastMM and {$DEFINE UseReleaseStack}, the parallel version is at best 6.3x faster than the serial one. With ScaleMM it is up to 6.7x faster:

主站蜘蛛池模板: 吉隆县| 靖江市| 扎兰屯市| 稷山县| 安徽省| 嘉祥县| 安岳县| 大化| 宿松县| 鸡西市| 安阳市| 江口县| 府谷县| 油尖旺区| 富蕴县| 台北县| 永胜县| 沙坪坝区| 谷城县| 东阳市| 乐亭县| 榆中县| 彩票| 永仁县| 竹溪县| 嘉兴市| 新乐市| 钟祥市| 化隆| 彩票| 大冶市| 昌黎县| 荆州市| 共和县| 金华市| 江油市| 云林县| 呼玛县| 犍为县| 通道| 奉化市|