-
Notifications
You must be signed in to change notification settings - Fork 11
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
Fix tests for memory leak patch #15
Conversation
50390c0
to
986f736
Compare
Relates to iterative/vscode-dvc#967 |
@FeelyChau would you be able to confirm if this fixes the issue? |
986f736
to
3ffe123
Compare
Thanks for the contribution and sorry for being late. |
Sorry, that check skipped locally for me because I didn't have
Should be fixed now. |
@@ -6,12 +6,6 @@ PythonReference::PythonReference(PythonObject *scope) : mScope(scope) { | |||
mCapsule = PyCapsule_New(this, nullptr, nullptr); | |||
} | |||
|
|||
PythonReference::~PythonReference() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[F] This Unref was causing the same errors shown in nodejs/node-addon-api#998. Removing the Unref gets rid of the errors. The explanation for why we shouldn't be doing this is shown in the issue here.
I originally left the method in and empty but that led to linting errors. We need this method or the tests fail 🤦🏻 😢 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😢
7cf166c
to
d9dd2d3
Compare
dc4f821
to
307459d
Compare
307459d
to
42a7ee5
Compare
@@ -47,7 +47,6 @@ if (isMainThread) { | |||
console.log('train task is completed'); | |||
setTimeout(() => { | |||
clearInterval(alive); | |||
console.log(foo.ping('x')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[F] This call is to an object that is in the middle of garbage collection. I could get the call to work by moving it outside of setTimeout
on node v14 but not v12. I would assume that is because garbage collection works slightly differently between the two versions. I would also assume that the test worked previously because the object was not being collected at this point. Please let me know if you disagree with these assumptions.
Thanks
src/core/object.cc
Outdated
info.Env(), pybind::reinterpret_borrow<pybind::object>(result)); | ||
Py_DECREF(result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pybind::reinterpret_borrow
holds the memory of result
, this call is unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was @rickycao-qy's change, I will remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thank you @mattseddon
@FeelyChau can this get merged now? |
Any plans to merge? Please lmk and I will close. |
@rickycao-qy I have been looking into #10 and saw that you had a fix for it prepared in #12.
I've spent some time getting the tests to pass locally. Would you be able to take a look for me?
Thanks,
Matt