Articles Unified Memory Management - Coming with 10.4 Beta by Dalija Prasnikar

emailx45

Местный
Регистрация
5 Май 2008
Сообщения
3,571
Реакции
2,438
Credits
573
Unified Memory Management - Coming with 10.4 Beta
Dalija Prasnikar - 03/Mar/2020
[SHOWTOGROUPS=4,20]
As announced on previous roadmaps, the 10.4 release of Delphi is planned to have unified memory management. That means retiring the ARC compiler on mobile platforms, which will now operate under the same good old manual memory management model that originated on Windows.

Unification is good. Completely different memory management models require slightly different code. That alone breaks the promise of a single code base for all platforms. In reality, if you need to target platforms with different memory management models you will find yourself coding under the requirements of manual memory management where ARC will only throw you some curveballs. Constrained ARC is bad ARC, it is not useful, it cannot unleash its full power.

On one side I am happy because of unification, on the other I am sad to see the ARC compiler go. It had great potential and was mostly brought down by unoptimized RTL/FMX code that was written for manual memory management. There is a whole lot of code that could be written cleaner, simpler under full ARC. There is a whole a lot of fiddling around we could avoid. Oh, well, you can't win them all.

Anyone using Delphi on mobile platforms will have to check their code and make adjustments for the new (old) memory management model. Any shared code that is already working on non-ARC platforms will continue to work as-is. Changes are only required in code that was exclusively running under mobile ARC compilers, relying on automatic memory management for object instances.

Retiring ARC compilers also means DisposeOf will be retired, too. Hooray!

I assume that DisposeOf will just be deprecated for the time being, so you will not have to change code that uses it (on the classic compiler it calls Free, so the functionality is the same), but you will be able to completely remove it if you wish.

I expect that removing ARC will give a significant performance boost to mobile applications. But, mostly due to RTL/FMX code that is not optimized for ARC compiler, not the ARC compiler itself (even though ARC will always add some performance overhead, code that is not optimized for ARC adds a lot more).

For more information on other upcoming features and participation in the 10.4 Beta program, go to:
Для просмотра ссылки Войди или Зарегистрируйся

-----------------------------
--- Guest:
I have only 1 question, Application.ProcessMessages; will it work on android? ( inside for loops to update UI )

--- Dalija:
Application.ProcessMessages is not related to memory management.

It is obsolete on Android and it will never work again. Change happened in Tokyo when FMX UI thread was no longer separate thread on Android and now it is the same as Android UI thread.

That change occurred because having two UI threads created number of issues in FMX applications when interacting with Android OS. This was bug fix change and because of that it will never be reverted.
[/SHOWTOGROUPS]