From 7d012b527f2de06dcc5ffaf932472dafa897fcfd Mon Sep 17 00:00:00 2001 From: MrBounty Date: Sat, 11 Jan 2025 13:50:32 +0100 Subject: [PATCH] Write every 1000 map Now if I run a big ADD query, write every 1000 entities to prevent a maps array too big and go OOM --- src/ziqlParser.zig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ziqlParser.zig b/src/ziqlParser.zig index 2bfaf41..c1e0868 100644 --- a/src/ziqlParser.zig +++ b/src/ziqlParser.zig @@ -352,6 +352,12 @@ pub const Parser = struct { maps.append(data_map.clone() catch return ZipponError.MemoryError) catch return ZipponError.MemoryError; + if (maps.items.len >= 1_000) { + self.file_engine.addEntity(struct_name, maps.items, &buff.writer()) catch return ZipponError.CantWriteEntity; + for (maps.items) |*map| map.deinit(); + maps.clearRetainingCapacity(); + } + token = self.toker.last_token; if (token.tag == .l_paren) continue; break;