You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 5, 2021. It is now read-only.
I noticed that when creating a PyObject in Java using method call(...) or callMethod(...), it lives forever....
In method PyLib_CallAndReturnObject, an object is first created
(pyReturnValue = PyObject_CallObject), then its reference is incremented
(Py_INCREF (pyReturnValue)), and then the reference is incremented again in the PyObject constructor in Java:
PyObject(long pointer) {
if (pointer == 0) {
throw new IllegalArgumentException("pointer == 0");
}
PyLib.incRef(pointer);
this.pointer = pointer;
}
However, I found only one case, when the counter decrements - the PyObject's finalize(). Therefore, the object continues to exist with two references, and a memory leak occurs.
Is this a bug, or am I misunderstanding something? (sorry, this is my first expirience with Python C API)
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello guys,
I noticed that when creating a PyObject in Java using method
call(...)
orcallMethod(...)
, it lives forever....In method
PyLib_CallAndReturnObject
, an object is first created(
pyReturnValue = PyObject_CallObject
), then its reference is incremented(
Py_INCREF (pyReturnValue)
), and then the reference is incremented again in the PyObject constructor in Java:However, I found only one case, when the counter decrements - the PyObject's
finalize()
. Therefore, the object continues to exist with two references, and a memory leak occurs.Is this a bug, or am I misunderstanding something? (sorry, this is my first expirience with Python C API)
The text was updated successfully, but these errors were encountered: