fix OutOfMemory error

This commit is contained in:
Marcos Uchoa 2025-08-08 00:43:34 -03:00
parent a822d01bd5
commit 8f02438506
4 changed files with 5 additions and 5 deletions

View file

@ -15,7 +15,7 @@ services:
resources: resources:
limits: limits:
cpus: "0.30" cpus: "0.30"
memory: "338MB" memory: "330MB"
zig1: &zig zig1: &zig
container_name: zig-pay-1 container_name: zig-pay-1
build: . build: .
@ -36,7 +36,7 @@ services:
resources: resources:
limits: limits:
cpus: "0.60" cpus: "0.60"
memory: "6MB" memory: "10MB"
zig2: zig2:
<<: *zig <<: *zig
container_name: zig-pay-2 container_name: zig-pay-2

View file

@ -27,7 +27,7 @@ pub const ExchangeConnection = struct {
listen_thread: Thread = undefined, listen_thread: Thread = undefined,
pub fn init(host: []const u8, port: u16) !ExchangeConnection { pub fn init(host: []const u8, port: u16) !ExchangeConnection {
var buf: [1024]u8 = undefined; var buf: [4096]u8 = undefined;
var pba = heap.FixedBufferAllocator.init(&buf); var pba = heap.FixedBufferAllocator.init(&buf);
const addrList = try net.getAddressList(pba.allocator(), host, port); const addrList = try net.getAddressList(pba.allocator(), host, port);

View file

@ -15,7 +15,7 @@ pub fn main() !void {
var post_endpoints = endpoints.EndpointsManager{}; var post_endpoints = endpoints.EndpointsManager{};
var put_endpoints = endpoints.EndpointsManager{}; var put_endpoints = endpoints.EndpointsManager{};
std.debug.print("Init context: OK\n", .{}); std.debug.print("Init context\n", .{});
try ctx.init(); try ctx.init();
defer ctx.deinit(); defer ctx.deinit();
std.debug.print("Context: OK\n", .{}); std.debug.print("Context: OK\n", .{});

View file

@ -37,7 +37,7 @@ pub const HttpService = struct {
mutex: Mutex, mutex: Mutex,
pub fn init(id: u64, name: []const u8, host: []const u8, port: u16, num_connections: usize, allocator: Allocator) ServiceError!HttpService { pub fn init(id: u64, name: []const u8, host: []const u8, port: u16, num_connections: usize, allocator: Allocator) ServiceError!HttpService {
var buf: [1024]u8 = undefined; var buf: [4096]u8 = undefined;
var pba = heap.FixedBufferAllocator.init(&buf); var pba = heap.FixedBufferAllocator.init(&buf);
const addrList = net.getAddressList(pba.allocator(), host, port) catch return ServiceError.NotFound; const addrList = net.getAddressList(pba.allocator(), host, port) catch return ServiceError.NotFound;