Thema: Delphi Von Sharemem zu FastMM

Einzelnen Beitrag anzeigen

Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.063 Beiträge
 
Delphi 12 Athens
 
#6

AW: Von Sharemem zu FastMM

  Alt 7. Apr 2011, 14:33
Es gibt im FastMM-Verzeichnis eine Include-Datei (options.inc oder so) ... darin stehen auch nochmal einige Erklärungen zu den einzelnen Werten.

PS: da gibt es auch eine option, welche derartige Zugriffe, auf bereits freigegebene Objekte, aufspürt oder zumindestens dabei helfen soll.


Wird die DLL statisch geladen, dann muß mindestens Folgendes eingestellt sein (oder alles überall aktiv):
in der DLL > freigeben für Sharen, also das andere Module diesen Speichermanager mit nutzen dürfen
in der EXE > es soll der Andere genutzt werden, wenn ein anderer MM gefunden wurde


[add]
http://www.shenturk.com/sources/self...MM4Options.inc
Delphi-Quellcode:
{Allow sharing of the memory manager between a main application and DLLs that
were also compiled with FastMM. This allows you to pass dynamic arrays and
long strings to DLL functions provided both are compiled to use FastMM.
Sharing will only work if the library that is supposed to share the memory
manager was compiled with the "AttemptToUseSharedMM" option set. Note that if
the main application is single threaded and the DLL is multi-threaded that you
have to set the IsMultiThread variable in the main application to true or it
will crash when a thread contention occurs. Note that statically linked DLL
files are initialized before the main application, so the main application may
well end up sharing a statically loaded DLL's memory manager and not the other
way around. }

{$define ShareMM}

{Allow sharing of the memory manager by a DLL with other DLLs (or the main
application if this is a statically loaded DLL) that were also compiled with
FastMM. Set this option with care in dynamically loaded DLLs, because if the
DLL that is sharing its MM is unloaded and any other DLL is still sharing
the MM then the application will crash. This setting is only relevant for
DLL libraries and requires ShareMM to also be set to have any effect.
Sharing will only work if the library that is supposed to share the memory
manager was compiled with the "AttemptToUseSharedMM" option set. Note that
if DLLs are statically linked then they will be initialized before the main
application and then the DLL will in fact share its MM with the main
application. This option has no effect unless ShareMM is also set.}

{$define ShareMMIfLibrary}

{Define this option to allow sharing between the default memory manager and
FastMM. This option only works together with the memory manager of BDS2006.
With this option enabled FastMM can be shared with applications using the
Delphi 2006 MM and vice versa. (You may have to add SimpleShareMem.pas to the
project using the Delphi 2006 memory manager to enable sharing.)}

{$define EnableSharingWithDefaultMM}

{Define this to attempt to share the MM of the main application or other loaded
DLLs in the same process that were compiled with ShareMM set. When sharing a
memory manager, memory leaks caused by the sharer will not be freed
automatically. Take into account that statically linked DLLs are initialized
before the main application, so set the sharing options accordingly.}

{$define AttemptToUseSharedMM}
Neuste Erkenntnis:
Seit Pos einen dritten Parameter hat,
wird PoSex im Delphi viel seltener praktiziert.

Geändert von himitsu ( 7. Apr 2011 um 14:38 Uhr)
  Mit Zitat antworten Zitat