-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory Leak? #251
Comments
question:
As I see - there are 10 new "conn = " .. without "close()" |
Interestingly, this doesn't seem to make a difference (tested locally, the issue persists). I think the fact that we have finalisers explains this. |
The other thing to say is that my system appears to be allocating quite a lot more memory than I would have anticipated. In particular I'm downloading roughly 160 million |
I can't reproduce this on Julia 1.7.2, LibPQ 1.13.0 . Running on MacOS 12.4 under Rosetta. This is the code I've run - I'm using a data-generating query instead of reading data from a table: using LibPQ
function connection(f, dsn::AbstractString)
conn = LibPQ.Connection(dsn)
return try
f(conn)
finally
close(conn)
end
end
_localhost_dsn() = "<snip>" # My postgres server connection details
local_connection(f) = connection(f, _localhost_dsn())
function get_data(n::Integer, not_null::Bool)
return local_connection() do conn
r = execute(
conn,
"SELECT s.data::float8 FROM generate_series(0,$n,0.1) AS s(data)";
binary_format=true,
not_null,
)
LibPQ.columntable(r)
return nothing
end
end
for i in 1:10
println(i)
get_data(4_000_000, false)
GC.gc()
end What type & how many rows were you retrieving in your FYI, in my case I tried both The only thing that seemed to make a temporary difference was commenting out the call to |
MWE (less connection to a database with a large table):
Based on the above, this looks like a memory leak.
For reference, I have 32GB of RAM and 0 swap.
edit: julia 1.7.3, LibPQ 1.13.0
The text was updated successfully, but these errors were encountered: