-
Notifications
You must be signed in to change notification settings - Fork 43
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 #29
Comments
Thanks for letting me know I will take a look and get back to you promptly
…Sent from my iPhone
On 2 Dec 2016, at 16:47, Ratanak Lun ***@***.***> wrote:
I've been trying to find the cause of a memory leak in my application that uses msnodesqlv8 and it seems to be caused by msnodesqlv8. I have the following test code:
const msnodesqlv8 = require('msnodesqlv8');
msnodesqlv8.open('Driver={SQL Server Native Client 11.0};Server=localhost\\SQLEXPRESS;Trusted_Connection=yes;', (err, conn) => {
if (err) {
throw err;
}
setInterval(() => {
conn.queryRaw('select 1+1', (err, results) => {
if (err) {
throw err;
}
console.log(results);
});
}, 100);
});
The query executes successfully, but when monitoring the memory usage, the usage just keeps going up until it uses so much the process has to be killed. It does not look like queries are being cleaned up properly.
I took a look into the code and think it might have to do with SQL handles not being freed. I noticed that in the Free method of the OdbcHandle class, handle is set to nullptr before the call to SQLFreeHandle. This would cause the handle to not be freed. (Reference)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
your test was a great help, thanks. This issue should now be corrected in latest version 0.2.11. Please give it a go and see if it helps. p.s. I have run your test on Node 6 for 3 hours and memory footprint has not moved. |
Thanks for getting on this issue quickly. Yes, it does seem a lot more stable. Closing for now, but I'll let you know if I experience any issues. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've been trying to find the cause of a memory leak in my application that uses msnodesqlv8 and it seems to be caused by msnodesqlv8. I have the following test code:
The query executes successfully, but when monitoring the memory usage, the usage just keeps going up until it uses so much the process has to be killed. It does not look like queries are being cleaned up properly.
I took a look into the code and think it might have to do with SQL handles not being freed. I noticed that in the
Free
method of theOdbcHandle
class,handle
is set tonullptr
before the call toSQLFreeHandle
. This would cause the handle to not be freed. (Reference)The text was updated successfully, but these errors were encountered: