How to use FastMM4 in a Delphi 6 package?
Asked Answered
I

2

7

I have been using FastMM4 version 4.92 in my Delphi 6 Pro application smoothly. I now want to use it in a package I created (BPL). I tried putting the units in the Contains section and then moving them to the top of the list but I still get the error from FastMM4 complaining that it is not the first unit to be initialized. To fix this I want to put FastMM4 in the Requires section but I can't find a DCP file for FastMM4 anywhere (runtime library). Does anyone know how to make this happen?

Incubate answered 8/12, 2010 at 5:43 Comment(3)
Memory manager is global for the entire application. You can't use it selectable in only one BPL. Either you use it in the entrire app or don't use it at all. However, you can place MM's code in exe or bpl.Geber
@Alexander: or don't use it at all? maybe you mean don't use a custom memory manager but the default one... AFAIK there's no way to not use a memory manager.Agenda
@Robert : Can you provide me pointers to include FastMM into a Delphi 6 application. I am not able to see the Memory Leak log file. ThanksMoulton
J
4

Probably, the reason you've got this error is that you should include FastMM4 unit not in your package, but in project where you are testing(using) your newcreated package(ofcourse on the first place in 'uses' section).

Judicative answered 8/12, 2010 at 6:41 Comment(1)
Not enough to do this. If you want your application which uses runtime packages to use FastMM you must build the fastMM shared componentry (fastmm.dll and/or fastmm_fulldebugmode.dll) and use the modified borlandmm.dll.Barnabas
I
3

Did you set UseRuntimePackages in the FastMM4Options.inc file? Otherwise you could try to use ShareMem and the BorlndMM.dll replacement that comes with FastMM. Although ShareMem is designed for DLLs, its use should route all memory management routines to those in the BorlndMM.dll, allowing both the standard packages and yours to use FastMM code.

Ionian answered 8/12, 2010 at 19:32 Comment(2)
I think your answer is probably more accurate than mine.Barnabas
I'm not using runtime packages in my project. Do the units that reside in static packages that are linked into the main project go through FastMM4? I assumed they didn't so that is why I am trying to force the use of FastMM4 into my packages (DPK). Is my assumption wrong?Incubate

© 2022 - 2024 — McMap. All rights reserved.