Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!

Dev-C++ Modernized With Powerful New FastMM5 Memory Manager For Delphi

Embarcadero Dev-C++ is an open source C/C++ IDE project built in Delphi. Dev-C++ has been downloaded over 67 MILLON times since 2000 and a modernization effort was sponsored by Embarcadero to bring it up to the latest version of Delphi. The original version by Bloodshed software was originally built in Delphi 6 and then probably upgraded to Delphi 7. A newer unofficial fork called Orwell Dev-C++ continued upgrading the project in Delphi 7 but the last release was in 2015. The Orwell fork of Dev-C++ uses the custom FastMM4 4.991 memory manager which came out in 2012. There is a newer version of FastMM4 4.992 which came out in 2016.

FastMM4 is a memory manager for Delphi by Pierre le Riche. It is available under both an MPL and LGPL license. Delphi actually ships with a custom version of FastMM4 and there is a discussion over on Delphi-PRAXiS about the differences between the two. FastMM4 is described as “A fast replacement memory manager for Embarcadero Delphi applications that scales well under multi-threaded usage, is not prone to memory fragmentation, and supports shared memory without the use of external .DLL files.” Some of it’s advantages are listed as:

  • Fast
  • Low overhead. FastMM is designed for an average of 5% and maximum of 10% overhead per block.
  • Supports up to 3GB of user mode address space under Windows 32-bit and 4GB under Windows 64-bit. Add the “$SetPEFlags $20” option (in curly braces) to your .dpr to enable this.
  • Highly aligned memory blocks. Can be configured for either 8-byte or 16-byte alignment.
  • Good scaling under multi-threaded applications

In 2020, developer Pierre le Riche released a complete rewrite of FastMM4 called FastMM5. As part of the Dev-C++ modernization effort we upgraded the memory manager in it from FastMM4 to FastMM5. FastMM5 is available under a GPL and commercial license. This means that it can be used with another GPL project or a commercial license can be purchased to use it with your projects. It is described as “Version 5 is a complete rewrite of FastMM. It is designed from the ground up to simultaneously keep the strengths and address the shortcomings of version 4.992“. The differences between FastMM5 and FastMM4 are listed as:

  • Multithreaded scaling across multiple CPU cores is massively improved, without memory usage blowout. It can be configured to scale close to linearly for any number of CPU cores.
  • In the Fastcode memory manager benchmark tool FastMM 5 scores 15% higher than FastMM 4.992 on the single threaded benchmarks, and 30% higher on the multithreaded benchmarks. (I7-8700K CPU, EnableMMX and AssumeMultithreaded options enabled.)
  • It is fully configurable runtime. There is no need to change conditional defines and recompile to change options. (It is however backward compatible with many of the version 4 conditional defines.)
  • Debug mode uses the same debug support library as version 4 (FastMM_FullDebugMode.dll) by default, but custom stack trace routines are also supported. Call FastMM_EnterDebugMode to switch to debug mode (“FullDebugMode”) and call FastMM_ExitDebugMode to return to performance mode. Calls may be nested, in which case debug mode will be exited after the last FastMM_ExitDebugMode call.
  • Supports 8, 16, 32 or 64 byte alignment of all blocks. Call FastMM_EnterMinimumAddressAlignment to request a minimum block alignment, and FastMM_ExitMinimumAddressAlignment to rescind a prior request. Calls may be nested, in which case the coarsest alignment request will be in effect.
  • All event notifications (errors, memory leak messages, etc.) may be routed to the debugger (via OutputDebugString), a log file, the screen or any combination of the three. Messages are built using templates containing mail-merge tokens. Templates may be changed runtime to facilitate different layouts and/or translation into any language. Templates fully support Unicode, and the log file may be configured to be written in UTF-8 or UTF-16 format, with or without a BOM.
  • It may be configured runtime to favour speed, memory usage efficiency or a blend of the two via the FastMM_SetOptimizationStrategy call.

The latest version of Embarcadero Dev-C++ (version 6) is now available with the new FastMM5 memory manager in place. A number of other enhancements are also available in the new version like an upgraded compiler (TDM GCC 9.2.0) which supports C++17 and partial C++20.

Head over and check out the full source code for the FastMM5 memory manager over on GitHub.

Head over and check out the full source code for the Embarcadero sponsored version of Dev-C++ with the new memory manager.

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

FMXExpress.com has over 600 articles with all kinds of tips and tricks for Delphi FireMonkey on Android, IOS, OSX, Windows, and Linux.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.