#1 2010-11-23 09:16:32

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 5,299
Website

SynScaleMM - fast scaling memory manager for Delphi

We just released a new unit to the source code repository.

It's a simple, small and compact MM, built on top of the main Memory Manager(FastMM4 is a good candidate, standard since Delphi 2007), architectured in order to scale on multi core CPU's (which is what FastMM4 is lacking).

Original code is ScaleMM - Fast scaling memory manager for Delphi by André Mussche.

Modifications/fork to SynScaleMM:
  - Based on http://code.google.com/p/scalemm r8 revision, from Nov 19, 2010;
  - Compiles from Delphi 6 up to Delphi XE;
  - Some pascal code converted to faster asm;
  - Some code refactoring, a lot of comments added;
  - Added (experimental) medium block handling from 2048 bytes up to 16384;
  - Released under MPL 1.1/GPL 2.0/LGPL 2.1 tri-license.

See http://synopse.info/forum/viewtopic.php?pid=771#p771

Offline

#2 2010-12-03 10:10:55

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 5,299
Website

Re: SynScaleMM - fast scaling memory manager for Delphi

Refreshed version of SynScaleMM.

Now could be used on production.
Scales very well on multi-core CPUs, with thread-intensive real applications (like servers).

See this picture (taken from ScaleMM site in google code):
FastMM4|TopMM|SynScaleMM&chdlp=b&chls=2,4,1|1|1&chma=5,0,5,25&chtt=Scaling+comparison&nonsense=something_that_ends_with.png

In this graph, horizontal scale is the number of threads, and vertical scale is the execution time (the lower, the better).

Offline

#3 2010-12-04 15:36:57

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 5,299
Website

Re: SynScaleMM - fast scaling memory manager for Delphi

In another benchmark:

chart?chxl=1:|Borland+MM|FastMM4|ScaleMM+1|ScaleMM+2&chxr=0,0,34000|1,5,100&chxt=y,x&chbh=a&chs=480x225&cht=bvg&chco=A2C180,3D7930,FF9900&chds=-5,34000,0,34000,0,34000&chd=t:18000,15000,32000,34000|0,6000,0,19400|0,3400,0,13000&chdl=Delphi+7+Enhanced+RTL|Delphi+2007|Delphi+2010&chtt=Delphi+Memory+Manager+scaling

Graph groups are the following:
1. Borland's MM (only for Delphi 7);
2. FastMM4;
3. SynScaleMM over Borland's MM (only for Delphi 7);
4. SynScaleMM over FastMM4.

The higher, the better.

See http://synopse.info/forum/viewtopic.php?pid=892#p892 for explanations.

Offline

#4 2010-12-04 16:54:23

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 5,299
Website

Re: SynScaleMM - fast scaling memory manager for Delphi

To download this unit, just go to our source code repository:

http://synopse.info/fossil/finfo?name=SynScaleMM.pas

Log in as anonymous, then select the wanted version (the upper the later in the list), then click on the "Download" link topmost of the page.

Offline

#5 2010-12-06 15:43:01

visli
New member
Registered: 2010-12-06
Posts: 3

Re: SynScaleMM - fast scaling memory manager for Delphi

Need memory leaks report function.

Offline

#6 2010-12-06 16:47:07

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 5,299
Website

Re: SynScaleMM - fast scaling memory manager for Delphi

visli wrote:

Need memory leaks report function.

That's a good observation.
If you need memory leak reporting and debugging, use FastMM4 in FullDebugMode, with the external library.

Then, when your application has no memory leak, just include the SynScaleMM in your .dpr uses clause, and check about speed enhancements in multi-thread.

Even FastMM4 has in fact two part of code: one optimized for production (written mostly in asm), one slower but more complete for debugging and memory leak reporting.

I don't want to reinvent the wheel, so FastMM4 memory leak reporting sounds perfect to me, and there is no plan to add such a feature to SynScaleMM in the future.
wink

Offline

#7 2010-12-06 19:20:06

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 5,299
Website

Re: SynScaleMM - fast scaling memory manager for Delphi

I've uploaded a new version of SynScaleMM.
See http://synopse.info/fossil/finfo?name=SynScaleMM.pas

It's now synchronized with r19 revision, from Dec 6, 2010, with some enhancements proper to SynScaleMM. In particular, I tried to clean 5 points of implementation against this r19 revision of ScaleMM.

For example, there is a new SPINWAITBACKOFF conditional, which is defined by default, in order to follow the Backing Off Locks with Spin-Wait Loops, as stated by Intel documentation.

Now seems working with C_ARRAYSIZE = 32... I've cleaned some Scale_Getmem() and Scale_Freemem() calls.

Offline

#8 2011-03-12 18:52:28

hpw
New member
Registered: 2011-03-10
Posts: 2

Re: SynScaleMM - fast scaling memory manager for Delphi

Hi,

I made simple benchmark test programm specialliy for FastMM4 & TBBMM using 4 threads (Delphi 2007 on dual core)...

Just using some special benches the benchmark application crashes using lastest SyncScaleMM O:(

How to drop/send this simple test bench to get ride of GPF's...

Hp

Offline

#9 2011-03-13 12:25:10

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 5,299
Website

Re: SynScaleMM - fast scaling memory manager for Delphi

1) are you sure you put SynScaleMM as the first unit in your .dpr file?

2) you can send to me some source code by email when clicking on the "Email" button below my name, left side of every post of mine

Offline

#10 2011-03-13 15:02:40

hpw
New member
Registered: 2011-03-10
Posts: 2

Re: SynScaleMM - fast scaling memory manager for Delphi

Hi,

yes it's the only one...no FastMM4 used!

will send it...

Hp

Offline

#11 2011-03-20 09:56:01

marven
New member
Registered: 2011-03-20
Posts: 4

Re: SynScaleMM - fast scaling memory manager for Delphi

I've created a calculation intensive application in Delphi. Previously it was running ok at a Quad core PC at about 60-70% of the max. cpu capacity.
Yesterday I've assembled a heavily overclocked I7-990x system. I was anxious to get my software running, only to find out that the performance dropped to about 16% on all 12 cores ater a minute or so......
After a bit of googling I found your memory manager, installed it and was able to get the maximum performance (100%) out of all cores, a speed improvement of 625% !!
That really made my day smile

One thing I noticed though: often when a calculation finished an access violation was triggered.
Initially I thought the overclocking made my system unstable, but it also ocurred on other systems.
Once I enabled the {$define PURE_PASCAL} compiler switch the program seems to be running stable again. Maybe there's a glitch in the assembly code?
I'll continue testing today and let you now how it works out.

Thanks again!

Offline

#12 2011-03-21 12:31:34

marven
New member
Registered: 2011-03-20
Posts: 4

Re: SynScaleMM - fast scaling memory manager for Delphi

Update:

I've tested my system all day yesterday, and everything still seems stable. smile

Offline

#13 2011-03-21 13:22:34

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 5,299
Website

Re: SynScaleMM - fast scaling memory manager for Delphi

What if you undefine PURE_PASCAL and SCALE_INJECT_OFFSET ?

Offline

#14 2011-04-06 13:06:33

marven
New member
Registered: 2011-03-20
Posts: 4

Re: SynScaleMM - fast scaling memory manager for Delphi

Same result as before, the calculation becomes unstable (Access violation) in 3 of the 5 runs that I did.
While using pure pascal i did another 6 runs which all went fine

Last edited by marven (2011-04-06 13:07:24)

Offline

#15 2011-04-10 21:25:23

cstuffer
Member
Registered: 2010-07-21
Posts: 11

Re: SynScaleMM - fast scaling memory manager for Delphi

Hello,

Is there some performances degradation to define "PURE_PASCAL" ??

If yes.. is this noticable ?
(I mean in a real life application)

Thank you
Carl

Offline

#16 2011-04-11 05:51:01

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 5,299
Website

Re: SynScaleMM - fast scaling memory manager for Delphi

PURE_PASCAL is slower than the asm version.
But if you need multi-thread scaling, it could be a safe solution.

For performance, it will depend on the application.
So use your application, take a clock, and guess what's the better for your purpose.

Offline

#17 2011-09-05 14:20:22

marven
New member
Registered: 2011-03-20
Posts: 4

Re: SynScaleMM - fast scaling memory manager for Delphi

I've just installed the new version of Delphi (XE2) and SynscaleMM no longer seems to work.
The error reported by delphi is "SynScaleMM.pas(1736): E2010 Incompatible types: 'NativeInt' and 'Integer'"

Apparently the compiler expects a NativeInt instead of an Integer for variable aSize in  "function Scale_GetMem(aSize: Integer): Pointer;"
Is this something you can easily fix?

Offline

Board footer

Powered by FluxBB