-
Notifications
You must be signed in to change notification settings - Fork 55
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
Cannot use same PreparedStatement with different data multiple times in one Transaction #31
Comments
I fixed it here, not sure if right approach. Feel free to use. |
I am 95% sure this would leak memory, the reason I have a lua table to store the queries is exactly because tables us proper GC, while storing a reference does not. Try running loads of transactions with callbacks that all reference all of the queries and the transaction itself (so that the closures keep references to them), and check mysqloo.objectCount() to see if anything leaks. |
yeah it definitely does leak |
actually both main and mine leak at same rate lol |
I did this test on my current version and it went back down from 50k objects to ~11 or something local finished = 0;
local time = SysTime()
local query1 = db:prepare("SELECT ?")
local query2 = db:prepare("SELECT ?, 1")
local totalAmount = 50000
for i = 1, totalAmount do
local transaction = db:createTransaction()
query1:setNumber(1, math.random(1, 1000))
query2:setNumber(1, math.random(1, 1000))
transaction:addQuery(query1)
transaction:addQuery(query2)
function transaction:onSuccess()
finished = finished + 1
if (finished == totalAmount) then
print("Done:", SysTime() - time, query1, query2, transaction)
collectgarbage("collect")
end
end
transaction:start()
end |
Fixed in master |
It uses the last dataset given to the PrepareStatement
The text was updated successfully, but these errors were encountered: