Форум: "Основная";
Текущий архив: 2007.10.14;
Скачать: [xml.tar.bz2];
Вниз
А где модуль ShareMem в Delphi 2006? Найти похожие ветки
← →
Solo © (2007-07-31 14:00) [0]Пробую Дельфи 2006, не могу найти модуль ShareMem... Он что, теперь не нужен?
← →
Rouse_ © (2007-07-31 14:09) [1]uses ShareMem; Становись курсором на него и CTRL+ENTER
← →
Инс © (2007-07-31 16:15) [2]
> Он что, теперь не нужен?
Поправьте если ошибаюсь, сам до сих пор на семерке, но где-то слышал, что да. Там новый менеджер памяти по умолчанию - FastMem, с ним проблем нет.
← →
tesseract © (2007-07-31 16:59) [3]
> Там новый менеджер памяти по умолчанию - FastMem, с ним
> проблем нет.
ShareMem всё равно нужен. Так написано в справке.
← →
DrPass © (2007-07-31 17:30) [4]
> tesseract © (31.07.07 16:59) [3]
>
> > Там новый менеджер памяти по умолчанию - FastMem, с ним
>
> > проблем нет.
>
>
> ShareMem всё равно нужен. Так написано в справке.
Справка в Delphi 2006 - это не документ, а рудимент. Sharemem не нужен, т.к. используется менеджер памяти FastMM.
← →
tesseract © (2007-07-31 17:37) [5]
> Sharemem не нужен, т.к. используется менеджер памяти FastMM.
И он перекрывает менеджер памяти Windows в DLL? ShareMem вроде нужен для того, чтобы DLL использовала менеджер памяти совместимый с borland-ским ? Или я чего-то не понял в FastMM ?
← →
DrPass © (2007-07-31 17:55) [6]
> tesseract © (31.07.07 17:37) [5]
Да нет. Менеджер памяти в Delphi - это надстройка над виндовым. Проблема в том, что если между написанными в Delphi приложением и библиотекой передавать объекты с управляемым временем жизни, то оригинальный Борландовский менеджер памяти ими будет управлять некорректно, т.к. и в библиотеке, и в приложении будут раздельные управляющие структуры. Sharemem был затычкой, которая позволяла их синхронизировать через дополнительную библиотечку.
Менеджер памяти FastMM сделан более толково, и в затычке просто не нуждается, он сам следит за синхронизацией
← →
tesseract © (2007-07-31 18:03) [7]
> Менеджер памяти FastMM сделан более толково, и в затычке
> просто не нуждается, он сам следит за синхронизацией
Ну исправили, так исправили. Один чёрт я в DLL память не выделял под переброску данных.
← →
Loginov Dmitry © (2007-07-31 19:43) [8]Не знаю, как в Delphi2006, но в Delphi2007 ShareMem для передаче динамических объектов между exe и dll по-прежнему нужен. Видимо, разработчики Delphi по-своему переработали FastMM.
Причем криво. В отличие от Delphi7, в Delphi2007 при компиляции с пакетами ShareMem подключать нельзя.
← →
atruhin © (2007-08-01 10:15) [9]> Sharemem не нужен, т.к. используется менеджер памяти FastMM.
Не изучал работу с 2006, но в FastMM есть отдельные опции по расшариванию памяти:
{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}
Что включенно по умолчанию в 2006 не знаю, но лучше и проще скачать полный FastMM и использовать его.
Страницы: 1 вся ветка
Форум: "Основная";
Текущий архив: 2007.10.14;
Скачать: [xml.tar.bz2];
Память: 0.48 MB
Время: 0.041 c