fixed the "leak". We were de-initializing the allocator before we de-initialized the things allocated with it.
This commit is contained in:
1 parent
fd71b631c4
commit
1140905a4f
7 files changed
+123
-69
No files matched your search
@@ -5,7 +5,7 @@ const bufzilla = @import("bufzilla");
|
||||
const shared = @import("shared");
|
||||
const server = @import("server.zig");
|
||||
|
||||
pub fn spawn(chunk: *shared.chunk.Chunk(), comptime T: type, allocator: std.mem.Allocator, value: T) !void {
|
||||
pub fn spawn(chunk: *shared.chunk.Chunk, comptime T: type, allocator: std.mem.Allocator, value: T) !void {
|
||||
std.debug.assert(value.id == shared.entity.INVALID_ID);
|
||||
|
||||
const id = server.next_entity_id;
|
||||
@@ -14,7 +14,7 @@ pub fn spawn(chunk: *shared.chunk.Chunk(), comptime T: type, allocator: std.mem.
|
||||
var entity = value;
|
||||
entity.id = id;
|
||||
|
||||
inline for (@typeInfo(shared.chunk.Chunk()).@"struct".fields) |field| {
|
||||
inline for (@typeInfo(shared.chunk.Chunk).@"struct".fields) |field| {
|
||||
if (field.type == shared.chunk.Storage(T)) {
|
||||
try @field(chunk, field.name).items.append(allocator, entity);
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user