-block allocator now track allocated blocks and is able to free memory

-jobs data is now allocated in System struct
-written memory cleanup (AddressSanitizer don't show any leak)
This commit is contained in:
Mergul 2019-06-18 16:45:38 +02:00
parent 9824b587fb
commit 235bbb49f2
7 changed files with 214 additions and 41 deletions

View file

@ -8,7 +8,8 @@ static struct ECS
mixin template System(uint jobs_count = 32)
{
__gshared ushort system_id;
EntityManager.Job[] _ecs_jobs;
uint __ecs_jobs_count = jobs_count;
/*EntityManager.Job[] _ecs_jobs;
void __ecsInitialize() nothrow @nogc
{
@ -16,6 +17,13 @@ static struct ECS
import std.experimental.allocator;
_ecs_jobs = Mallocator.instance.makeArray!(EntityManager.Job)(jobs_count);
}
void __ecsDeinitialize() nothrow @nogc
{
import std.experimental.allocator.mallocator;
import std.experimental.allocator;
Mallocator.instance.dispose(_ecs_jobs);
}*/
}
mixin template Component()