-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:
parent
9824b587fb
commit
235bbb49f2
7 changed files with 214 additions and 41 deletions
|
|
@ -141,18 +141,20 @@ struct ChangeTestSystem
|
|||
{
|
||||
//printf("Entity added! ID: ");
|
||||
foreach (i; 0 .. data.length)
|
||||
printf("Entity added! ID: %u\n",data.entites[i].id.id);
|
||||
//writeln("Entity added! ID: ", data.entites[i].id.id);
|
||||
printf("Entity added! ID: %u\n",data.entites[i].id);
|
||||
//writeln("Entity added! ID: ", data.entites[i].id);
|
||||
}
|
||||
|
||||
void onRemoveEntity(EntitiesData data)
|
||||
{
|
||||
writeln("Entity removed! ID: ", data.entites[0].id);
|
||||
//writeln("Entity removed! ID: ", data.entites[0].id);
|
||||
printf("Entity removed! ID: %u\n",data.entites[0].id);
|
||||
}
|
||||
|
||||
void onChangeEntity(EntitiesData data)
|
||||
{
|
||||
writeln("Entity changed! ID: ", data.entites[0].id);
|
||||
//writeln("Entity changed! ID: ", data.entites[0].id);
|
||||
printf("Entity changed! ID: %u\n",data.entites[0].id);
|
||||
}
|
||||
|
||||
bool onBegin()
|
||||
|
|
@ -538,6 +540,7 @@ int main()
|
|||
//foreach(i; 0..1_000_000)gEM.removeEntity(gEM.addEntity(tmpl).id);
|
||||
|
||||
EntityID[] idss = Mallocator.instance.makeArray!EntityID(5000);//[5000]
|
||||
scope(exit)Mallocator.instance.dispose(idss);
|
||||
|
||||
foreach (i; 0 .. 200)
|
||||
{
|
||||
|
|
@ -568,7 +571,7 @@ int main()
|
|||
//foreach(j; 0..1_000)gEM.addEntity(tmpl);
|
||||
|
||||
gEM.beginRegister();
|
||||
gEM.registerSystem!TestSystem2(0);
|
||||
//gEM.registerSystem!TestSystem2(0);
|
||||
gEM.endRegister();
|
||||
|
||||
//gEM.generateDependencies();
|
||||
|
|
@ -674,13 +677,16 @@ int main()
|
|||
|
||||
gEM.removeComponents!(TestComp4)(entity.id);
|
||||
|
||||
gEM.commit();
|
||||
gEM.commit();//*/
|
||||
|
||||
writeEntityComponents(gEM.getEntity(entity.id));
|
||||
//import std.stdio;
|
||||
//writeln((cast(uint*)tmpl.info.first_block)[0..48]);
|
||||
gEM.freeTemplate(tmpl);
|
||||
gEM.freeTemplate(tmpl2);
|
||||
EntityManager.destroy();
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue