the internal garbage collector now collects more garbage

This commit is contained in:
BlackMATov
2025-09-20 03:09:04 +07:00
parent 7f6909e48c
commit 521ad94278
3 changed files with 30 additions and 2 deletions

View File

@@ -1222,7 +1222,7 @@ builder_mt:destruction_policy :: id -> builder
## vX.X.X
- Nothing yet, stay tuned!
- The internal garbage collector now collects more garbage
## v1.2.0

View File

@@ -5,7 +5,6 @@
- Improve the performance of required fragments by caching first-level required chunks.
- Improve the performance of builders that are used multiple times by caching hint chunks.
- Queries can cache major chunks to avoid finding them every time.
- Add a function to shrink storages to free unused memory.
- observers and events
- add INDEX fragment trait
- use compact prefix-tree for chunks

View File

@@ -5922,6 +5922,35 @@ function __evolved_collect_garbage()
__release_table(__table_pool_tag.chunk_list, postorder_chunk_stack)
end
for table_tag = 1, __table_pool_tag.__count do
local table_pool = __tagged_table_pools[table_tag]
for pool_index = 1, table_pool.__size do
table_pool[pool_index] = {}
end
end
do
---@type table<integer, evolved.chunk>
local new_entity_chunks = {}
for entity_primary, entity_chunk in __lua_next, __entity_chunks do
new_entity_chunks[entity_primary] = entity_chunk
end
__entity_chunks = new_entity_chunks
end
do
---@type table<integer, integer>
local new_entity_places = {}
for entity_primary, entity_place in __lua_next, __entity_places do
new_entity_places[entity_primary] = entity_place
end
__entity_places = new_entity_places
end
__evolved_commit()
end