Closed sdykae closed 1 month ago
Do you have a full stack of the leak? Maybe if you run with -freference-trace
. Is the jsonStringSlice
ever freed?
I'm not sure how you're conclusing that execOpts
is leaking even though you're saying the leak is happening after execOpts
terminates. I might be missing something, but that seems like a leap.
While I don't think it's related to the leak, your handleQueryError
doesn't seem correct to me - there's no guarantee that the connection you get from the pool in handleQueryError
is the same error connection that caused the error when you called execOpts
. If you care about the error, you need to explicitly get a connection. Something like:
var conn = try pool.acquire();
defer conn.release();
conn.execOpts(....) catch |err| {
return handleError(err, &conn)
}
...
Thank you for the insight, somehow I needed to free the json string ([]const u8
) when execOpts
is used, and not with queryOpts
I need to understand how can i use
execOpts
without having memory leak I was usingqueryOpts
with a insert query, and everything were fine, I tried to migrate to use execOpts and get more details on errors, but I've got memory leaks on the same code that was ok withqueryOpts
the code is simple
I have a zap service
the functions are:
Error