/fastmm4/FastMM4.pas

http://github.com/ghquant/Delphi-OmniThreadLibrary · Pascal · 1308 lines · 103 code · 50 blank · 1155 comment · 0 complexity · 7c663f27fd6768bc219296cae74ba966 MD5 · raw file

Large files are truncated click here to view the full file

  1. (*
  2. Fast Memory Manager 4.99
  3. Description:
  4. A fast replacement memory manager for Embarcadero Delphi Win32 applications
  5. that scales well under multi-threaded usage, is not prone to memory
  6. fragmentation, and supports shared memory without the use of external .DLL
  7. files.
  8. Homepage:
  9. http://fastmm.sourceforge.net
  10. Advantages:
  11. - Fast
  12. - Low overhead. FastMM is designed for an average of 5% and maximum of 10%
  13. overhead per block.
  14. - Supports up to 3GB of user mode address space under Windows 32-bit and 4GB
  15. under Windows 64-bit. Add the "$SetPEFlags $20" option (in curly braces)
  16. to your .dpr to enable this.
  17. - Highly aligned memory blocks. Can be configured for either 8-byte or 16-byte
  18. alignment.
  19. - Good scaling under multi-threaded applications
  20. - Intelligent reallocations. Avoids slow memory move operations through
  21. not performing unneccesary downsizes and by having a minimum percentage
  22. block size growth factor when an in-place block upsize is not possible.
  23. - Resistant to address space fragmentation
  24. - No external DLL required when sharing memory between the application and
  25. external libraries (provided both use this memory manager)
  26. - Optionally reports memory leaks on program shutdown. (This check can be set
  27. to be performed only if Delphi is currently running on the machine, so end
  28. users won't be bothered by the error message.)
  29. - Supports Delphi 4 (or later), C++ Builder 4 (or later), Kylix 3.
  30. Usage:
  31. Delphi:
  32. Place this unit as the very first unit under the "uses" section in your
  33. project's .dpr file. When sharing memory between an application and a DLL
  34. (e.g. when passing a long string or dynamic array to a DLL function), both the
  35. main application and the DLL must be compiled using this memory manager (with
  36. the required conditional defines set). There are some conditional defines
  37. (inside FastMM4Options.inc) that may be used to tweak the memory manager. To
  38. enable support for a user mode address space greater than 2GB you will have to
  39. use the EditBin* tool to set the LARGE_ADDRESS_AWARE flag in the EXE header.
  40. This informs Windows x64 or Windows 32-bit (with the /3GB option set) that the
  41. application supports an address space larger than 2GB (up to 4GB). In Delphi 6
  42. and later you can also specify this flag through the compiler directive
  43. {$SetPEFlags $20}
  44. *The EditBin tool ships with the MS Visual C compiler.
  45. C++ Builder 6:
  46. Refer to the instructions inside FastMM4BCB.cpp.
  47. License:
  48. This work is copyright Professional Software Development / Pierre le Riche. It
  49. is released under a dual license, and you may choose to use it under either the
  50. Mozilla Public License 1.1 (MPL 1.1, available from
  51. http://www.mozilla.org/MPL/MPL-1.1.html) or the GNU Lesser General Public
  52. License 2.1 (LGPL 2.1, available from
  53. http://www.opensource.org/licenses/lgpl-license.php). If you find FastMM useful
  54. or you would like to support further development, a donation would be much
  55. appreciated. My banking details are:
  56. Country: South Africa
  57. Bank: ABSA Bank Ltd
  58. Branch: Somerset West
  59. Branch Code: 334-712
  60. Account Name: PSD (Distribution)
  61. Account No.: 4041827693
  62. Swift Code: ABSAZAJJ
  63. My PayPal account is:
  64. bof@psd.co.za
  65. Contact Details:
  66. My contact details are shown below if you would like to get in touch with me.
  67. If you use this memory manager I would like to hear from you: please e-mail me
  68. your comments - good and bad.
  69. Snailmail:
  70. PO Box 2514
  71. Somerset West
  72. 7129
  73. South Africa
  74. E-mail:
  75. plr@psd.co.za
  76. Support:
  77. If you have trouble using FastMM, you are welcome to drop me an e-mail at the
  78. address above, or you may post your questions in the BASM newsgroup on the
  79. Embarcadero news server (which is where I hang out quite frequently).
  80. Disclaimer:
  81. FastMM has been tested extensively with both single and multithreaded
  82. applications on various hardware platforms, but unfortunately I am not in a
  83. position to make any guarantees. Use it at your own risk.
  84. Acknowledgements (for version 4):
  85. - Eric Grange for his RecyclerMM on which the earlier versions of FastMM were
  86. based. RecyclerMM was what inspired me to try and write my own memory
  87. manager back in early 2004.
  88. - Primoz Gabrijelcic for helping to track down various bugs.
  89. - Dennis Christensen for his tireless efforts with the Fastcode project:
  90. helping to develop, optimize and debug the growing Fastcode library.
  91. - JiYuan Xie for implementing the leak reporting code for C++ Builder.
  92. - Pierre Y. for his suggestions regarding the extension of the memory leak
  93. checking options.
  94. - Hanspeter Widmer for his suggestion to have an option to display install and
  95. uninstall debug messages and moving options to a separate file, as well as
  96. the new usage tracker.
  97. - Anders Isaksson and Greg for finding and identifying the "DelphiIsRunning"
  98. bug under Delphi 5.
  99. - Francois Malan for various suggestions and bug reports.
  100. - Craig Peterson for helping me identify the cache associativity issues that
  101. could arise due to medium blocks always being an exact multiple of 256 bytes.
  102. Also for various other bug reports and enhancement suggestions.
  103. - Jarek Karciarz, Vladimir Ulchenko (Vavan) and Bob Gonder for their help in
  104. implementing the BCB support.
  105. - Ben Taylor for his suggestion to display the object class of all memory
  106. leaks.
  107. - Jean Marc Eber and Vincent Mahon (the Memcheck guys) for the call stack
  108. trace code and also the method used to catch virtual method calls on freed
  109. objects.
  110. - Nahan Hyn for the suggestion to be able to enable or disable memory leak
  111. reporting through a global variable (the "ManualLeakReportingControl"
  112. option.)
  113. - Leonel Togniolli for various suggestions with regard to enhancing the bug
  114. tracking features of FastMM and other helpful advice.
  115. - Joe Bain and Leonel Togniolli for the workaround to QC#10922 affecting
  116. compilation under Delphi 2005.
  117. - Robert Marquardt for the suggestion to make localisation of FastMM easier by
  118. having all string constants together.
  119. - Simon Kissel and Fikret Hasovic for their help in implementing Kylix support.
  120. - Matthias Thoma, Petr Vones, Robert Rossmair and the rest of the JCL team for
  121. their debug info library used in the debug info support DLL and also the
  122. code used to check for a valid call site in the "raw" stack trace code.
  123. - Andreas Hausladen for the suggestion to use an external DLL to enable the
  124. reporting of debug information.
  125. - Alexander Tabakov for various good suggestions regarding the debugging
  126. facilities of FastMM.
  127. - M. Skloff for some useful suggestions and bringing to my attention some
  128. compiler warnings.
  129. - Martin Aignesberger for the code to use madExcept instead of the JCL library
  130. inside the debug info support DLL.
  131. - Diederik and Dennis Passmore for the suggestion to be able to register
  132. expected leaks.
  133. - Dario Tiraboschi and Mark Gebauer for pointing out the problems that occur
  134. when range checking and complete boolean evaluation is turned on.
  135. - Arthur Hoornweg for notifying me of the image base being incorrect for
  136. borlndmm.dll.
  137. - Theo Carr-Brion and Hanspeter Widmer for finding the false alarm error
  138. message "Block Header Has Been Corrupted" bug in FullDebugMode.
  139. - Danny Heijl for reporting the compiler error in "release" mode.
  140. - Omar Zelaya for reporting the BCB support regression bug.
  141. - Dan Miser for various good suggestions, e.g. not logging expected leaks to
  142. file, enhancements the stack trace and messagebox functionality, etc.
  143. - Arjen de Ruijter for fixing the bug in GetMemoryLeakType that caused it
  144. to not properly detect expected leaks registered by class when in
  145. "FullDebugMode".
  146. - Aleksander Oven for reporting the installation problem when trying to use
  147. FastMM in an application together with libraries that all use runtime
  148. packages.
  149. - Kristofer Skaug for reporting the bug that sometimes causes the leak report
  150. to be shown, even when all the leaks have been registered as expected leaks.
  151. Also for some useful enhancement suggestions.
  152. - Günther Schoch for the "RequireDebuggerPresenceForLeakReporting" option.
  153. - Jan Schlüter for the "ForceMMX" option.
  154. - Hallvard Vassbotn for various good enhancement suggestions.
  155. - Mark Edington for some good suggestions and bug reports.
  156. - Paul Ishenin for reporting the compilation error when the NoMessageBoxes
  157. option is set and also the missing call stack entries issue when "raw" stack
  158. traces are enabled, as well as for the Russian translation.
  159. - Cristian Nicola for reporting the compilation bug when the
  160. CatchUseOfFreedInterfaces option was enabled (4.40).
  161. - Mathias Rauen (madshi) for improving the support for madExcept in the debug
  162. info support DLL.
  163. - Roddy Pratt for the BCB5 support code.
  164. - Rene Mihula for the Czech translation and the suggestion to have dynamic
  165. loading of the FullDebugMode DLL as an option.
  166. - Artur Redzko for the Polish translation.
  167. - Bart van der Werf for helping me solve the DLL unload order problem when
  168. using the debug mode borlndmm.dll library, as well as various other
  169. suggestions.
  170. - JRG ("The Delphi Guy") for the Spanish translation.
  171. - Justus Janssen for Delphi 4 support.
  172. - Vadim Lopushansky and Charles Vinal for reporting the Delphi 5 compiler
  173. error in version 4.50.
  174. - Johni Jeferson Capeletto for the Brazilian Portuguese translation.
  175. - Kurt Fitzner for reporting the BCb6 compiler error in 4.52.
  176. - Michal Niklas for reporting the Kylix compiler error in 4.54.
  177. - Thomas Speck and Uwe Queisser for German translations.
  178. - Zaenal Mutaqin for the Indonesian translation.
  179. - Carlos Macao for the Portuguese translation.
  180. - Michael Winter for catching the performance issue when reallocating certain
  181. block sizes.
  182. - dzmitry[li] for the Belarussian translation.
  183. - Marcelo Montenegro for the updated Spanish translation.
  184. - Jud Cole for finding and reporting the bug which may trigger a read access
  185. violation when upsizing certain small block sizes together with the
  186. "UseCustomVariableSizeMoveRoutines" option.
  187. - Zdenek Vasku for reporting and fixing the memory manager sharing bug
  188. affecting Windows 95/98/Me.
  189. - RB Winston for suggesting the improvement to GExperts "backup" support.
  190. - Thomas Schulz for reporting the bug affecting large address space support
  191. under FullDebugMode, as well as the recursive call bug when attempting to
  192. report memory leaks when EnableMemoryLeakReporting is disabled.
  193. - Luigi Sandon for the Italian translation.
  194. - Werner Bochtler for various suggestions and bug reports.
  195. - Markus Beth for suggesting the "NeverSleepOnThreadContention" option.
  196. - JiYuan Xie for the Simplified Chinese translation.
  197. - Andrey Shtukaturov for the updated Russian translation, as well as the
  198. Ukrainian translation.
  199. - Dimitry Timokhov for finding two elusive bugs in the memory leak class
  200. detection code.
  201. - Paulo Moreno for fixing the AllocMem bug in FullDebugMode that prevented
  202. large blocks from being cleared.
  203. - Vladimir Bochkarev for the suggestion to remove some unnecessary code if the
  204. MM sharing mechanism is disabled.
  205. - Loris Luise for the version constant suggestion.
  206. - J.W. de Bokx for the MessageBox bugfix.
  207. - Igor Lindunen for reporting the bug that caused the Align16Bytes option to
  208. not work in FullDebugMode.
  209. - Ionut Muntean for the Romanian translation.
  210. - Florent Ouchet for the French translation.
  211. - Marcus Mönnig for the ScanMemoryPoolForCorruptions suggestion and the
  212. suggestion to have the option to scan the memory pool before every
  213. operation when in FullDebugMode.
  214. - Francois Piette for bringing under my attention that
  215. ScanMemoryPoolForCorruption was not thread safe.
  216. - Michael Rabatscher for reporting some compiler warnings.
  217. - QianYuan Wang for the Simplified Chinese translation of FastMM4Options.inc.
  218. - Maurizio Lotauro and Christian-W. Budde for reporting some Delphi 5
  219. compiler errors.
  220. - Patrick van Logchem for the DisableLoggingOfMemoryDumps option.
  221. - Norbert Spiegel for the BCB4 support code.
  222. - Uwe Schuster for the improved string leak detection code.
  223. - Murray McGowan for improvements to the usage tracker.
  224. - Michael Hieke for the SuppressFreeMemErrorsInsideException option as well
  225. as a bugfix to GetMemoryMap.
  226. - Richard Bradbrook for fixing the Windows 95 FullDebugMode support that was
  227. broken in version 4.94.
  228. - Zach Saw for the suggestion to (optionally) use SwitchToThread when
  229. waiting for a lock on a shared resource to be released.
  230. - Everyone who have made donations. Thanks!
  231. - Any other Fastcoders or supporters that I have forgotten, and also everyone
  232. that helped with the older versions.
  233. Change log:
  234. Version 1.00 (28 June 2004):
  235. - First version (called PSDMemoryManager). Based on RecyclerMM (free block
  236. stack approach) by Eric Grange.
  237. Version 2.00 (3 November 2004):
  238. - Complete redesign and rewrite from scratch. Name changed to FastMM to
  239. reflect this fact. Uses a linked-list approach. Is faster, has less memory
  240. overhead, and will now catch most bad pointers on FreeMem calls.
  241. Version 3.00 (1 March 2005):
  242. - Another rewrite. Reduced the memory overhead by: (a) not having a separate
  243. memory area for the linked list of free blocks (uses space inside free
  244. blocks themselves) (b) batch managers are allocated as part of chunks (c)
  245. block size lookup table size reduced. This should make FastMM more CPU
  246. cache friendly.
  247. Version 4.00 (7 June 2005):
  248. - Yet another rewrite. FastMM4 is in fact three memory managers in one: Small
  249. blocks (up to a few KB) are managed through the binning model in the same
  250. way as previous versions, medium blocks (from a few KB up to approximately
  251. 256K) are allocated in a linked-list fashion, and large blocks are grabbed
  252. directly from the system through VirtualAlloc. This 3-layered design allows
  253. very fast operation with the most frequently used block sizes (small
  254. blocks), while also minimizing fragmentation and imparting significant
  255. overhead savings with blocks larger than a few KB.
  256. Version 4.01 (8 June 2005):
  257. - Added the options "RequireDebugInfoForLeakReporting" and
  258. "RequireIDEPresenceForLeakReporting" as suggested by Pierre Y.
  259. - Fixed the "DelphiIsRunning" function not working under Delphi 5, and
  260. consequently no leak checking. (Reported by Anders Isaksson and Greg.)
  261. Version 4.02 (8 June 2005):
  262. - Fixed the compilation error when both the "AssumeMultiThreaded" and
  263. "CheckHeapForCorruption options were set. (Reported by Francois Malan.)
  264. Version 4.03 (9 June 2005):
  265. - Added descriptive error messages when FastMM4 cannot be installed because
  266. another MM has already been installed or memory has already been allocated.
  267. Version 4.04 (13 June 2005):
  268. - Added a small fixed offset to the size of medium blocks (previously always
  269. exact multiples of 256 bytes). This makes performance problems due to CPU
  270. cache associativity limitations much less likely. (Reported by Craig
  271. Peterson.)
  272. Version 4.05 (17 June 2005):
  273. - Added the Align16Bytes option. Disable this option to drop the 16 byte
  274. alignment restriction and reduce alignment to 8 bytes for the smallest
  275. block sizes. Disabling Align16Bytes should lower memory consumption at the
  276. cost of complicating the use of aligned SSE move instructions. (Suggested
  277. by Craig Peterson.)
  278. - Added a support unit for C++ Builder 6 - Add FastMM4BCB.cpp and
  279. FastMM4.pas to your BCB project to use FastMM instead of the RTL MM. Memory
  280. leak checking is not supported because (unfortunately) once an MM is
  281. installed under BCB you cannot uninstall it... at least not without
  282. modifying the RTL code in exit.c or patching the RTL code runtime. (Thanks
  283. to Jarek Karciarz, Vladimir Ulchenko and Bob Gonder.)
  284. Version 4.06 (22 June 2005):
  285. - Displays the class of all leaked objects on the memory leak report and also
  286. tries to identify leaked long strings. Previously it only displayed the
  287. sizes of all leaked blocks. (Suggested by Ben Taylor.)
  288. - Added support for displaying the sizes of medium and large block memory
  289. leaks. Previously it only displayed details for small block leaks.
  290. Version 4.07 (22 June 2005):
  291. - Fixed the detection of the class of leaked objects not working under
  292. Windows 98/Me.
  293. Version 4.08 (27 June 2005):
  294. - Added a BorlndMM.dpr project to allow you to build a borlndmm.dll that uses
  295. FastMM4 instead of the default memory manager. You may replace the old
  296. DLL in the Delphi \Bin directory to make the IDE use this memory manager
  297. instead.
  298. Version 4.09 (30 June 2005):
  299. - Included a patch fix for the bug affecting replacement borlndmm.dll files
  300. with Delphi 2005 (QC#14007). Compile the patch, close Delphi, and run it
  301. once to patch your vclide90.bpl. You will now be able to use the
  302. replacement borlndmm.dll to speed up the Delphi 2005 IDE as well.
  303. Version 4.10 (7 July 2005):
  304. - Due to QC#14070 ("Delphi IDE attempts to free memory after the shutdown
  305. code of borlndmm.dll has been called"), FastMM cannot be uninstalled
  306. safely when used inside a replacement borlndmm.dll for the IDE. Added a
  307. conditional define "NeverUninstall" for this purpose.
  308. - Added the "FullDebugMode" option to pad all blocks with a header and footer
  309. to help you catch memory overwrite bugs in your applications. All blocks
  310. returned to freemem are also zeroed out to help catch bugs involving the
  311. use of previously freed blocks. Also catches attempts at calling virtual
  312. methods of freed objects provided the block in question has not been reused
  313. since the object was freed. Displays stack traces on error to aid debugging.
  314. - Added the "LogErrorsToFile" option to log all errors to a text file in the
  315. same folder as the application.
  316. - Added the "ManualLeakReportingControl" option (suggested by Nahan Hyn) to
  317. enable control over whether the memory leak report should be done or not
  318. via a global variable.
  319. Version 4.11 (7 July 2005):
  320. - Fixed a compilation error under Delphi 2005 due to QC#10922. (Thanks to Joe
  321. Bain and Leonel Togniolli.)
  322. - Fixed leaked object classes not displaying in the leak report in
  323. "FullDebugMode".
  324. Version 4.12 (8 July 2005):
  325. - Moved all the string constants to one place to make it easier to do
  326. translations into other languages. (Thanks to Robert Marquardt.)
  327. - Added support for Kylix. Some functionality is currently missing: No
  328. support for detecting the object class on leaks and also no MM sharing.
  329. (Thanks to Simon Kissel and Fikret Hasovic).
  330. Version 4.13 (11 July 2005):
  331. - Added the FastMM_DebugInfo.dll support library to display debug info for
  332. stack traces.
  333. - Stack traces for the memory leak report is now logged to the log file in
  334. "FullDebugMode".
  335. Version 4.14 (14 July 2005):
  336. - Fixed string leaks not being detected as such in "FullDebugMode". (Thanks
  337. to Leonel Togniolli.)
  338. - Fixed the compilation error in "FullDebugMode" when "LogErrorsToFile" is
  339. not set. (Thanks to Leonel Togniolli.)
  340. - Added a "Release" option to allow the grouping of various options and to
  341. make it easier to make debug and release builds. (Thanks to Alexander
  342. Tabakov.)
  343. - Added a "HideMemoryLeakHintMessage" option to not display the hint below
  344. the memory leak message. (Thanks to Alexander Tabakov.)
  345. - Changed the fill character for "FullDebugMode" from zero to $80 to be able
  346. to differentiate between invalid memory accesses using nil pointers to
  347. invalid memory accesses using fields of freed objects. FastMM tries to
  348. reserve the 64K block starting at $80800000 at startup to ensure that an
  349. A/V will occur when this block is accessed. (Thanks to Alexander Tabakov.)
  350. - Fixed some compiler warnings. (Thanks to M. Skloff)
  351. - Fixed some display bugs in the memory leak report. (Thanks to Leonel
  352. Togniolli.)
  353. - Added a "LogMemoryLeakDetailToFile" option. Some applications leak a lot of
  354. memory and can make the log file grow very large very quickly.
  355. - Added the option to use madExcept instead of the JCL Debug library in the
  356. debug info support DLL. (Thanks to Martin Aignesberger.)
  357. - Added procedures "GetMemoryManagerState" and "GetMemoryMap" to retrieve
  358. statistics about the current state of the memory manager and memory pool.
  359. (A usage tracker form together with a demo is also available.)
  360. Version 4.15 (14 July 2005):
  361. - Fixed a false 4GB(!) memory leak reported in some instances.
  362. Version 4.16 (15 July 2005):
  363. - Added the "CatchUseOfFreedInterfaces" option to catch the use of interfaces
  364. of freed objects. This option is not compatible with checking that a freed
  365. block has not been modified, so enable this option only when hunting an
  366. invalid interface reference. (Only relevant if "FullDebugMode" is set.)
  367. - During shutdown FastMM now checks that all free blocks have not been
  368. modified since being freed. (Only when "FullDebugMode" is set and
  369. "CatchUseOfFreedInterfaces" is disabled.)
  370. Version 4.17 (15 July 2005):
  371. - Added the AddExpectedMemoryLeaks and RemoveExpectedMemoryLeaks procedures to
  372. register/unregister expected leaks, thus preventing the leak report from
  373. displaying if only expected leaks occurred. (Thanks to Diederik and Dennis
  374. Passmore for the suggestion.) (Note: these functions were renamed in later
  375. versions.)
  376. - Fixed the "LogMemoryLeakDetailToFile" not logging memory leak detail to file
  377. as it is supposed to. (Thanks to Leonel Togniolli.)
  378. Version 4.18 (18 July 2005):
  379. - Fixed some issues when range checking or complete boolean evaluation is
  380. switched on. (Thanks to Dario Tiraboschi and Mark Gebauer.)
  381. - Added the "OutputInstallUninstallDebugString" option to display a message when
  382. FastMM is installed or uninstalled. (Thanks to Hanspeter Widmer.)
  383. - Moved the options to a separate include file. (Thanks to Hanspeter Widmer.)
  384. - Moved message strings to a separate file for easy translation.
  385. Version 4.19 (19 July 2005):
  386. - Fixed Kylix support that was broken in 4.14.
  387. Version 4.20 (20 July 2005):
  388. - Fixed a false memory overwrite report at shutdown in "FullDebugMode". If you
  389. consistently got a "Block Header Has Been Corrupted" error message during
  390. shutdown at address $xxxx0070 then it was probably a false alarm. (Thanks to
  391. Theo Carr-Brion and Hanspeter Widmer.}
  392. Version 4.21 (27 July 2005):
  393. - Minor change to the block header flags to make it possible to immediately
  394. tell whether a medium block is being used as a small block pool or not.
  395. (Simplifies the leak checking and status reporting code.)
  396. - Expanded the functionality around the management of expected memory leaks.
  397. - Added the "ClearLogFileOnStartup" option. Deletes the log file during
  398. initialization. (Thanks to M. Skloff.)
  399. - Changed "OutputInstallUninstallDebugString" to use OutputDebugString instead
  400. of MessageBox. (Thanks to Hanspeter Widmer.)
  401. Version 4.22 (1 August 2005):
  402. - Added a FastAllocMem function that avoids an unnecessary FillChar call with
  403. large blocks.
  404. - Changed large block resizing behavior to be a bit more conservative. Large
  405. blocks will be downsized if the new size is less than half of the old size
  406. (the threshold was a quarter previously).
  407. Version 4.23 (6 August 2005):
  408. - Fixed BCB6 support (Thanks to Omar Zelaya).
  409. - Renamed "OutputInstallUninstallDebugString" to "UseOutputDebugString", and
  410. added debug string output on memory leak or error detection.
  411. Version 4.24 (11 August 2005):
  412. - Added the "NoMessageBoxes" option to suppress the display of message boxes,
  413. which is useful for services that should not be interrupted. (Thanks to Dan
  414. Miser).
  415. - Changed the stack trace code to return the line number of the caller and not
  416. the line number of the return address. (Thanks to Dan Miser).
  417. Version 4.25 (15 August 2005):
  418. - Fixed GetMemoryLeakType not detecting expected leaks registered by class
  419. when in "FullDebugMode". (Thanks to Arjen de Ruijter).
  420. Version 4.26 (18 August 2005):
  421. - Added a "UseRuntimePackages" option that allows FastMM to be used in a main
  422. application together with DLLs that all use runtime packages. (Thanks to
  423. Aleksander Oven.)
  424. Version 4.27 (24 August 2005):
  425. - Fixed a bug that sometimes caused the leak report to be shown even though all
  426. leaks were registered as expected leaks. (Thanks to Kristofer Skaug.)
  427. Version 4.29 (30 September 2005):
  428. - Added the "RequireDebuggerPresenceForLeakReporting" option to only display
  429. the leak report if the application is run inside the IDE. (Thanks to Günther
  430. Schoch.)
  431. - Added the "ForceMMX" option, which when disabled will check the CPU for
  432. MMX compatibility before using MMX. (Thanks to Jan Schlüter.)
  433. - Added the module name to the title of error dialogs to more easily identify
  434. which application caused the error. (Thanks to Kristofer Skaug.)
  435. - Added an ASCII dump to the "FullDebugMode" memory dumps. (Thanks to Hallvard
  436. Vassbotn.)
  437. - Added the option "HideExpectedLeaksRegisteredByPointer" to suppress the
  438. display and logging of expected memory leaks that were registered by pointer.
  439. (Thanks to Dan Miser.) Leaks registered by size or class are often ambiguous,
  440. so these expected leaks are always logged to file (in FullDebugMode) and are
  441. never hidden from the leak display (only displayed if there is at least one
  442. unexpected leak).
  443. - Added a procedure "GetRegisteredMemoryLeaks" to return a list of all
  444. registered memory leaks. (Thanks to Dan Miser.)
  445. - Added the "RawStackTraces" option to perform "raw" stack traces, negating
  446. the need for stack frames. This will usually result in more complete stack
  447. traces in FullDebugMode error reports, but it is significantly slower.
  448. (Thanks to Hallvard Vassbotn, Dan Miser and the JCL team.)
  449. Version 4.31 (2 October 2005):
  450. - Fixed the crash bug when both "RawStackTraces" and "FullDebugMode" were
  451. enabled. (Thanks to Dan Miser and Mark Edington.)
  452. Version 4.33 (6 October 2005):
  453. - Added a header corruption check to all memory blocks that are identified as
  454. leaks in FullDebugMode. This allows better differentiation between memory
  455. pool corruption bugs and actual memory leaks.
  456. - Fixed the stack overflow bug when using "RawStackTraces".
  457. Version 4.35 (6 October 2005):
  458. - Fixed a compilation error when the "NoMessageBoxes" option is set. (Thanks
  459. to Paul Ishenin.)
  460. - Before performing a "raw" stack trace, FastMM now checks whether exception
  461. handling is in place. If exception handling is not in place FastMM falls
  462. back to stack frame tracing. (Exception handling is required to handle the
  463. possible A/Vs when reading invalid call addresses. Exception handling is
  464. usually always available except when SysUtils hasn't been initialized yet or
  465. after SysUtils has been finalized.)
  466. Version 4.37 (8 October 2005):
  467. - Fixed the missing call stack trace entry issue when dynamically loading DLLs.
  468. (Thanks to Paul Ishenin.)
  469. Version 4.39 (12 October 2005):
  470. - Restored the performance with "RawStackTraces" enabled back to the level it
  471. was in 4.35.
  472. - Fixed the stack overflow error when using "RawStackTraces" that I thought I
  473. had fixed in 4.31, but unfortunately didn't. (Thanks to Craig Peterson.)
  474. Version 4.40 (13 October 2005):
  475. - Improved "RawStackTraces" to have less incorrect extra entries. (Thanks to
  476. Craig Peterson.)
  477. - Added the Russian (by Paul Ishenin) and Afrikaans translations of
  478. FastMM4Messages.pas.
  479. Version 4.42 (13 October 2005):
  480. - Fixed the compilation error when "CatchUseOfFreedInterfaces" is enabled.
  481. (Thanks to Cristian Nicola.)
  482. Version 4.44 (25 October 2005):
  483. - Implemented a FastGetHeapStatus function in analogy with GetHeapStatus.
  484. (Suggested by Cristian Nicola.)
  485. - Shifted more of the stack trace code over to the support dll to allow third
  486. party vendors to make available their own stack tracing and stack trace
  487. logging facilities.
  488. - Mathias Rauen (madshi) improved the support for madExcept in the debug info
  489. support DLL. Thanks!
  490. - Added support for BCB5. (Thanks to Roddy Pratt.)
  491. - Added the Czech translation by Rene Mihula.
  492. - Added the "DetectMMOperationsAfterUninstall" option. This will catch
  493. attempts to use the MM after FastMM has been uninstalled, and is useful for
  494. debugging.
  495. Version 4.46 (26 October 2005):
  496. - Renamed FastMM_DebugInfo.dll to FastMM_FullDebugMode.dll and made the
  497. dependency on this library a static one. This solves a DLL unload order
  498. problem when using FullDebugMode together with the replacement
  499. borlndmm.dll. (Thanks to Bart van der Werf.)
  500. - Added the Polish translation by Artur Redzko.
  501. Version 4.48 (10 November 2005):
  502. - Fixed class detection for objects leaked in dynamically loaded DLLs that
  503. were relocated.
  504. - Fabio Dell'Aria implemented support for EurekaLog in the FullDebugMode
  505. support DLL. Thanks!
  506. - Added the Spanish translation by JRG ("The Delphi Guy").
  507. Version 4.49 (10 November 2005):
  508. - Implemented support for installing replacement AllocMem and leak
  509. registration mechanisms for Delphi/BCB versions that support it.
  510. - Added support for Delphi 4. (Thanks to Justus Janssen.)
  511. Version 4.50 (5 December 2005):
  512. - Renamed the ReportMemoryLeaks global variable to ReportMemoryLeaksOnShutdown
  513. to be more consistent with the Delphi 2006 memory manager.
  514. - Improved the handling of large blocks. Large blocks can now consist of
  515. several consecutive segments allocated through VirtualAlloc. This
  516. significantly improves speed when frequently resizing large blocks, since
  517. these blocks can now often be upsized in-place.
  518. Version 4.52 (7 December 2005):
  519. - Fixed the compilation error with Delphi 5. (Thanks to Vadim Lopushansky and
  520. Charles Vinal for reporting the error.)
  521. Version 4.54 (15 December 2005):
  522. - Added the Brazilian Portuguese translation by Johni Jeferson Capeletto.
  523. - Fixed the compilation error with BCB6. (Thanks to Kurt Fitzner.)
  524. Version 4.56 (20 December 2005):
  525. - Fixed the Kylix compilation problem. (Thanks to Michal Niklas.)
  526. Version 4.58 (1 February 2006):
  527. - Added the German translations by Thomas Speck and Uwe Queisser.
  528. - Added the Indonesian translation by Zaenal Mutaqin.
  529. - Added the Portuguese translation by Carlos Macao.
  530. Version 4.60 (21 February 2006):
  531. - Fixed a performance issue due to an unnecessary block move operation when
  532. allocating a block in the range 1261-1372 bytes and then reallocating it in
  533. the range 1373-1429 bytes twice. (Thanks to Michael Winter.)
  534. - Added the Belarussian translation by dzmitry[li].
  535. - Added the updated Spanish translation by Marcelo Montenegro.
  536. - Added a new option "EnableSharingWithDefaultMM". This option allows FastMM
  537. to be shared with the default MM of Delphi 2006. It is on by default, but
  538. MM sharing has to be enabled otherwise it has no effect (refer to the
  539. documentation for the "ShareMM" and "AttemptToUseSharedMM" options).
  540. Version 4.62 (22 February 2006):
  541. - Fixed a possible read access violation in the MoveX16LP routine when the
  542. UseCustomVariableSizeMoveRoutines option is enabled. (Thanks to Jud Cole for
  543. some great detective work in finding this bug.)
  544. - Improved the downsizing behaviour of medium blocks to better correlate with
  545. the reallocation behaviour of small blocks. This change reduces the number
  546. of transitions between small and medium block types when reallocating blocks
  547. in the 0.7K to 2.6K range. It cuts down on the number of memory move
  548. operations and improves performance.
  549. Version 4.64 (31 March 2006):
  550. - Added the following functions for use with FullDebugMode (and added the
  551. exports to the replacement BorlndMM.dll): SetMMLogFileName,
  552. GetCurrentAllocationGroup, PushAllocationGroup, PopAllocationGroup and
  553. LogAllocatedBlocksToFile. The purpose of these functions are to allow you to
  554. identify and log related memory leaks while your application is still
  555. running.
  556. - Fixed a bug in the memory manager sharing mechanism affecting Windows
  557. 95/98/ME. (Thanks to Zdenek Vasku.)
  558. Version 4.66 (9 May 2006):
  559. - Added a hint comment in this file so that FastMM4Messages.pas will also be
  560. backed up by GExperts. (Thanks to RB Winston.)
  561. - Fixed a bug affecting large address space (> 2GB) support under
  562. FullDebugMode. (Thanks to Thomas Schulz.)
  563. Version 4.68 (3 July 2006):
  564. - Added the Italian translation by Luigi Sandon.
  565. - If FastMM is used inside a DLL it will now use the name of the DLL as base
  566. for the log file name. (Previously it always used the name of the main
  567. application executable file.)
  568. - Fixed a rare A/V when both the FullDebugMode and RawStackTraces options were
  569. enabled. (Thanks to Primoz Gabrijelcic.)
  570. - Added the "NeverSleepOnThreadContention" option. This option may improve
  571. performance if the ratio of the the number of active threads to the number
  572. of CPU cores is low (typically < 2). This option is only useful for 4+ CPU
  573. systems, it almost always hurts performance on single and dual CPU systems.
  574. (Thanks to Werner Bochtler and Markus Beth.)
  575. Version 4.70 (4 August 2006):
  576. - Added the Simplified Chinese translation by JiYuan Xie.
  577. - Added the updated Russian as well as the Ukrainian translation by Andrey
  578. Shtukaturov.
  579. - Fixed two bugs in the leak class detection code that would sometimes fail
  580. to detect the class of leaked objects and strings, and report them as
  581. 'unknown'. (Thanks to Dimitry Timokhov)
  582. Version 4.72 (24 September 2006):
  583. - Fixed a bug that caused AllocMem to not clear blocks > 256K in
  584. FullDebugMode. (Thanks to Paulo Moreno.)
  585. Version 4.74 (9 November 2006):
  586. - Fixed a bug in the segmented large block functionality that could lead to
  587. an application freeze when upsizing blocks greater than 256K in a
  588. multithreaded application (one of those "what the heck was I thinking?"
  589. type bugs).
  590. Version 4.76 (12 January 2007):
  591. - Changed the RawStackTraces code in the FullDebugMode DLL
  592. to prevent it from modifying the Windows "GetLastError" error code.
  593. (Thanks to Primoz Gabrijelcic.)
  594. - Fixed a threading issue when the "CheckHeapForCorruption" option was
  595. enabled, but the "FullDebugMode" option was disabled. (Thanks to Primoz
  596. Gabrijelcic.)
  597. - Removed some unnecessary startup code when the MM sharing mechanism is
  598. disabled. (Thanks to Vladimir Bochkarev.)
  599. - In FullDebugMode leaked blocks would sometimes be reported as belonging to
  600. the class "TFreedObject" if they were allocated but never used. Such blocks
  601. will now be reported as "unknown". (Thanks to Francois Malan.)
  602. - In recent versions the replacement borlndmm.dll created a log file (when
  603. enabled) that used the "borlndmm" prefix instead of the application name.
  604. It is now fixed to use the application name, however if FastMM is used
  605. inside other DLLs the name of those DLLs will be used. (Thanks to Bart van
  606. der Werf.)
  607. - Added a "FastMMVersion" constant. (Suggested by Loris Luise.)
  608. - Fixed an issue with error message boxes not displaying under certain
  609. configurations. (Thanks to J.W. de Bokx.)
  610. - FastMM will now display only one error message at a time. If many errors
  611. occur in quick succession, only the first error will be shown (but all will
  612. be logged). This avoids a stack overflow with badly misbehaved programs.
  613. (Thanks to Bart van der Werf.)
  614. - Added a LoadDebugDLLDynamically option to be used in conjunction with
  615. FullDebugMode. In this mode FastMM_FullDebugMode.dll is loaded dynamically.
  616. If the DLL cannot be found, stack traces will not be available. (Thanks to
  617. Rene Mihula.)
  618. Version 4.78 (1 March 2007):
  619. - The MB_DEFAULT_DESKTOP_ONLY constant that is used when displaying messages
  620. boxes since 4.76 is not defined under Kylix, and the source would thus not
  621. compile. That constant is now defined. (Thanks to Werner Bochtler.)
  622. - Moved the medium block locking code that was duplicated in several places
  623. to a subroutine to reduce code size. (Thanks to Hallvard Vassbotn.)
  624. - Fixed a bug in the leak registration code that sometimes caused registered
  625. leaks to be reported erroneously. (Thanks to Primoz Gabrijelcic.)
  626. - Added the NoDebugInfo option (on by default) that suppresses the generation
  627. of debug info for the FastMM4.pas unit. This will prevent the integrated
  628. debugger from stepping into the memory manager. (Thanks to Primoz
  629. Gabrijelcic.)
  630. - Increased the default stack trace depth in FullDebugMode from 9 to 10 to
  631. ensure that the Align16Bytes setting works in FullDebugMode. (Thanks to
  632. Igor Lindunen.)
  633. - Updated the Czech translation. (Thanks to Rene Mihula.)
  634. Version 4.84 (7 July 2008):
  635. - Added the Romanian translation. (Thanks to Ionut Muntean.)
  636. - Optimized the GetMemoryMap procedure to improve speed.
  637. - Added the GetMemoryManagerUsageSummary function that returns a summary of
  638. the GetMemoryManagerState call. (Thanks to Hallvard Vassbotn.)
  639. - Added the French translation. (Thanks to Florent Ouchet.)
  640. - Added the "AlwaysAllocateTopDown" FullDebugMode option to help with
  641. catching bad pointer arithmetic code in an address space > 2GB. This option
  642. is enabled by default.
  643. - Added the "InstallOnlyIfRunningInIDE" option. Enable this option to
  644. only install FastMM as the memory manager when the application is run
  645. inside the Delphi IDE. This is useful when you want to deploy the same EXE
  646. that you use for testing, but only want the debugging features active on
  647. development machines. When this option is enabled and the application is
  648. not being run inside the IDE, then the default Delphi memory manager will
  649. be used (which, since Delphi 2006, is FastMM without FullDebugMode.) This
  650. option is off by default.
  651. - Added the "FullDebugModeInIDE" option. This is a convenient shorthand for
  652. enabling FullDebugMode, InstallOnlyIfRunningInIDE and
  653. LoadDebugDLLDynamically. This causes FastMM to be used in FullDebugMode
  654. when the application is being debugged on development machines, and the
  655. default memory manager when the same executable is deployed. This allows
  656. the debugging and deployment of an application without having to compile
  657. separate executables. This option is off by default.
  658. - Added a ScanMemoryPoolForCorruptions procedure that checks the entire
  659. memory pool for corruptions and raises an exception if one is found. It can
  660. be called at any time, but is only available in FullDebugMode. (Thanks to
  661. Marcus Mönnig.)
  662. - Added a global variable "FullDebugModeScanMemoryPoolBeforeEveryOperation".
  663. When this variable is set to true and FullDebugMode is enabled, then the
  664. entire memory pool is checked for consistency before every GetMem, FreeMem
  665. and ReallocMem operation. An "Out of Memory" error is raised if a
  666. corruption is found (and this variable is set to false to prevent recursive
  667. errors). This obviously incurs a massive performance hit, so enable it only
  668. when hunting for elusive memory corruption bugs. (Thanks to Marcus Mönnig.)
  669. - Fixed a bug in AllocMem that caused the FPU stack to be shifted by one
  670. position.
  671. - Changed the default for option "EnableMMX" to false, since using MMX may
  672. cause unexpected behaviour in code that passes parameters on the FPU stack
  673. (like some "compiler magic" routines, e.g. VarFromReal).
  674. - Removed the "EnableSharingWithDefaultMM" option. This is now the default
  675. behaviour and cannot be disabled. (FastMM will always try to share memory
  676. managers between itself and the default memory manager when memory manager
  677. sharing is enabled.)
  678. - Introduced a new memory manager sharing mechanism based on memory mapped
  679. files. This solves compatibility issues with console and service
  680. applications. This sharing mechanism currently runs in parallel with the
  681. old mechanism, but the old mechanism can be disabled by undefining
  682. "EnableBackwardCompatibleMMSharing" in FastMM4Options.inc.
  683. - Fixed the recursive call error when the EnableMemoryLeakReporting option
  684. is disabled and an attempt is made to register a memory leak under Delphi
  685. 2006 or later. (Thanks to Thomas Schulz.)
  686. - Added a global variable "SuppressMessageBoxes" to enable or disable
  687. messageboxes at runtime. (Thanks to Craig Peterson.)
  688. - Added the leak reporting code for C++ Builder, as well as various other
  689. C++ Builder bits written by JiYuan Xie. (Thank you!)
  690. - Added the new Usage Tracker written by Hanspeter Widmer. (Thank you!)
  691. Version 4.86 (31 July 2008):
  692. - Tweaked the string detection algorithm somewhat to be less strict, and
  693. allow non-class leaks to be more often categorized as strings.
  694. - Fixed a compilation error under Delphi 5.
  695. - Made LogAllocatedBlocksToFile and ScanMemoryPoolForCorruptions thread
  696. safe. (Thanks to Francois Piette.)
  697. Version 4.88 (13 August 2008):
  698. - Fixed compiler warnings in NoOpRegisterExpectedMemoryLeak and
  699. NoOpUnRegisterExpectedMemoryLeak. (Thanks to Michael Rabatscher.)
  700. - Added the Simplified Chinese translation of FastMM4Options.inc by
  701. QianYuan Wang. (Thank you!)
  702. - Included the updated C++ Builder files with support for BCB6 without
  703. update 4 applied. (Submitted by JiYuan Xie. Thanks!)
  704. - Fixed a compilation error under Delphi 5.
  705. - Made LogAllocatedBlocksToFile and ScanMemoryPoolForCorruptions thread
  706. safe - for real this time. (Thanks to Francois Piette.)
  707. Version 4.90 (9 September 2008):
  708. - Added logging of the thread ID when capturing and displaying stack
  709. traces. (Suggested by Allen Bauer and Mark Edington.)
  710. - Fixed a Delphi 5 compiler error under FullDebugMode. (Thanks to Maurizio
  711. Lotauro and Christian-W. Budde.)
  712. - Changed a default setting in FastMM4Options.inc: RawStackTraces is now
  713. off by default due to the high number of support requests I receive with
  714. regards to the false postives it may cause. I recommend compiling debug
  715. builds of applications with the "Stack Frames" option enabled.
  716. - Fixed a compilation error under Kylix. (Thanks to Werner Bochtler.)
  717. - Official support for Delphi 2009.
  718. Version 4.92 (25 November 2008):
  719. - Added the DisableLoggingOfMemoryDumps option under FullDebugMode. When
  720. this option is set, memory dumps will not be logged for memory leaks or
  721. errors. (Thanks to Patrick van Logchem.)
  722. - Exposed the class and string type detection code in the interface section
  723. for use in application code (if required). (Requested by Patrick van
  724. Logchem.)
  725. - Fixed a bug in SetMMLogFileName that could cause the log file name to be
  726. set incorrectly.
  727. - Added BCB4 support. (Thanks to Norbert Spiegel.)
  728. - Included the updated Czech translation by Rene Mihula.
  729. - When FastMM raises an error due to a freed block being modified, it now
  730. logs detail about which bytes in the block were modified.
  731. Version 4.94 (28 August 2009):
  732. - Added the DoNotInstallIfDLLMissing option that prevents FastMM from
  733. installing itself if the FastMM_FullDebugMode.dll library is not
  734. available. (Only applicable when FullDebugMode and LoadDebugDLLDynamically
  735. are both enabled.) This is useful when the same executable will be used for
  736. both debugging and deployment - when the debug support DLL is available
  737. FastMM will be installed in FullDebugMode, and otherwise the default memory
  738. manager will be used.
  739. - Added the FullDebugModeWhenDLLAvailable option that combines the
  740. FullDebugMode, LoadDebugDLLDynamically and DoNotInstallIfDLLMissing options.
  741. - Re-enabled RawStackTraces by default. The frame based stack traces (even
  742. when compiling with stack frames enabled) are generally too incomplete.
  743. - Improved the speed of large block operations under FullDebugMode: Since
  744. large blocks are never reused, there is no point in clearing them before
  745. and after use (so it does not do that anymore).
  746. - If an error occurs in FullDebugMode and FastMM is unable to append to the
  747. log file, it will attempt to write to a log file of the same name in the
  748. "My Documents" folder. This feature is helpful when the executable resides
  749. in a read-only location and the default log file, which is derived from the
  750. executable name, would thus not be writeable.
  751. - Added support for controlling the error log file location through an
  752. environment variable. If the 'FastMMLogFilePath' environment variable is
  753. set then any generated error logs will be written to the specified folder
  754. instead of the default location (which is the same folder as the
  755. application).
  756. - Improved the call instruction detection code in the FastMM_FullDebugMode
  757. library. (Thanks to the JCL team.)
  758. - Improved the string leak detection and reporting code. (Thanks to Uwe
  759. Schuster.)
  760. - New FullDebugMode feature: Whenever FreeMem or ReallocMem is called, FastMM
  761. will check that the block was actually allocated through the same FastMM
  762. instance. This is useful for tracking down memory manager sharing issues.
  763. - Compatible with Delphi 2010.
  764. Version 4.96 (31 August 2010):
  765. - Reduced the minimum block size to 4 bytes from the previous value of 12
  766. bytes (only applicable to 8 byte alignment). This reduces memory usage if
  767. the application allocates many blocks <= 4 bytes in size.
  768. - Added colour-coded change indication to the FastMM usage tracker, making
  769. it easier to spot changes in the memory usage grid. (Thanks to Murray
  770. McGowan.)
  771. - Added the SuppressFreeMemErrorsInsideException FullDebugMode option: If
  772. FastMM encounters a problem with a memory block inside the FullDebugMode
  773. FreeMem handler then an "invalid pointer operation" exception will usually
  774. be raised. If the FreeMem occurs while another exception is being handled
  775. (perhaps in the try.. finally code) then the original exception will be
  776. lost. With this option set FastMM will ignore errors inside FreeMem when an
  777. exception is being handled, thus allowing the original exception to
  778. propagate. This option is on by default. (Thanks to Michael Hieke.)
  779. - Fixed Windows 95 FullDebugMode support that was broken in 4.94. (Thanks to
  780. Richard Bradbrook.)
  781. - Fixed a bug affecting GetMemoryMap performance and accuracy of measurements
  782. above 2GB if a large address space is not enabled for the project. (Thanks
  783. to Michael Hieke.)
  784. - Added the FullDebugModeRegisterAllAllocsAsExpectedMemoryLeak boolean flag.
  785. When set, all allocations are automatically registered as expected memory
  786. leaks. Only available in FullDebugMode. (Thanks to Brian Cook.)
  787. - Compatible with Delphi XE.
  788. Version 4.97 (30 September 2010):
  789. - Fixed a crash bug (that crept in in 4.96) that may manifest itself when
  790. resizing a block to 4 bytes or less.
  791. - Added the UseSwitchToThread option. Set this option to call SwitchToThread
  792. instead of sitting in a "busy waiting" loop when a thread contention
  793. occurs. This is used in conjunction with the NeverSleepOnThreadContention
  794. option, and has no effect unless NeverSleepOnThreadContention is also
  795. defined. This option may improve performance with many CPU cores and/or
  796. threads of different priorities. Note that the SwitchToThread API call is
  797. only available on Windows 2000 and later. (Thanks to Zach Saw.)
  798. Version 4.98 (23 September 2011):
  799. - Added the FullDebugModeCallBacks define which adds support for memory
  800. manager event callbacks. This allows the application to be notified of
  801. memory allocations, frees and reallocations as they occur. (Thanks to
  802. Jeroen Pluimers.)
  803. - Added security options ClearMemoryBeforeReturningToOS and
  804. AlwaysClearFreedMemory to force the clearing of memory blocks after being
  805. freed. This could possibly provide some protection against information
  806. theft, but at a significant performance penalty. (Thanks to Andrey
  807. Sozonov.)
  808. - Shifted the code in the initialization section to a procedure
  809. RunInitializationCode. This allows the startup code to be called before
  810. InitUnits, which is required by some software protection tools.
  811. - Added support for Delphi XE2 (Windows 32-bit and Windows 64-bit platforms
  812. only).
  813. Version 4.99 (6 November 2011):
  814. - Fixed crashes in the 64-bit BASM codepath when more than 4GB of memory is
  815. allocated.
  816. - Fixed bad record alignment under 64-bit that affected performance.
  817. - Fixed compilation errors with some older compilers.
  818. *)
  819. unit FastMM4;
  820. interface
  821. {$Include FastMM4Options.inc}
  822. {$RANGECHECKS OFF}
  823. {$BOOLEVAL OFF}
  824. {$OVERFLOWCHECKS OFF}
  825. {$OPTIMIZATION ON}
  826. {$TYPEDADDRESS OFF}
  827. {$LONGSTRINGS ON}
  828. {Compiler version defines}
  829. {$ifndef BCB}
  830. {$ifdef ver120}
  831. {$define Delphi4or5}
  832. {$endif}
  833. {$ifdef ver130}
  834. {$define Delphi4or5}
  835. {$endif}
  836. {$ifdef ver140}
  837. {$define Delphi6}
  838. {$endif}
  839. {$ifdef ver150}
  840. {$define Delphi7}
  841. {$endif}
  842. {$ifdef ver170}
  843. {$define Delphi2005}
  844. {$endif}
  845. {$else}
  846. {for BCB4, use the Delphi 5 codepath}
  847. {$ifdef ver120}
  848. {$define Delphi4or5}
  849. {$define BCB4}
  850. {$endif}
  851. {for BCB5, use the Delphi 5 codepath}
  852. {$ifdef ver130}
  853. {$define Delphi4or5}
  854. {$endif}
  855. {$endif}
  856. {$ifdef ver180}
  857. {$define B