Войти в систему

Home
    - Создать дневник
    - Написать в дневник
       - Подробный режим

LJ.Rossia.org
    - Новости сайта
    - Общие настройки
    - Sitemap
    - Оплата
    - ljr-fif

Редактировать...
    - Настройки
    - Список друзей
    - Дневник
    - Картинки
    - Пароль
    - Вид дневника

Сообщества

Настроить S2

Помощь
    - Забыли пароль?
    - FAQ
    - Тех. поддержка



Пишет nancygold ([info]nancygold)
@ 2024-05-14 11:23:00

Previous Entry  Add to memories!  Tell a Friend!  Next Entry
Настроение: amused

ECS and memory management
One thing evaded me was how one should manage entities in a robust ways.
Obvious approach is for every entity to keep an unordered set of the components in use.
And then explicitly calling free() on the dead entities.
Most implementations do that.
Yet now every access has to go through that components set.
And free() will leave dead ids in it's wake.
And some entity could have sent message to a dead entity.
And we got shared data, onto which every part of code depends.
So our entities are now forced to reside on same computer and run in same thread.
Something we wanted to avoid initially.
That was the reason I went digging the old Thief source code in hopes of getting ideas.

What I discovered is that the systems themselves should manage their memory.
Purging memory for freed/unreachable ids.
If the systems are in charge, we can do that in a phased way.

The hardest part now is making GC calling finalizes on the unreachable ECS indices.

So yeah, to free entities we need a list of unreachable entities, built by GC.
The we can run all systems, filtering their entities against the list.
Like everything with GC that can be done in multiple threads and incrementally.

Apparently that is the only solid solution here.
All other ways to manage memory will lead to architectural hell sooner of latter.



(Читать комментарии)

Добавить комментарий:

Как:
Identity URL: 
имя пользователя:    
Вы должны предварительно войти в LiveJournal.com
 
E-mail для ответов: 
Вы сможете оставлять комментарии, даже если не введете e-mail.
Но вы не сможете получать уведомления об ответах на ваши комментарии!
Внимание: на указанный адрес будет выслано подтверждение.
Имя пользователя:
Пароль:
Тема:
HTML нельзя использовать в теме сообщения
Сообщение:



Обратите внимание! Этот пользователь включил опцию сохранения IP-адресов пишущих комментарии к его дневнику.