Skip to content
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 with returnVectors enabled #2

Open
irridia opened this issue Dec 10, 2015 · 0 comments
Open

Memory leak with returnVectors enabled #2

irridia opened this issue Dec 10, 2015 · 0 comments

Comments

@irridia
Copy link

irridia commented Dec 10, 2015

I'm just now discovering this and the following seems to be The Right Thing To Do™:

diff --git a/pycldmodule.cc b/pycldmodule.cc
index 61b2e6a..446cc9b 100644
--- a/pycldmodule.cc
+++ b/pycldmodule.cc
@@ -217,6 +217,7 @@ detect(PyObject *self, PyObject *args, PyObject *kwArgs) {
                            textBytesFound,
                            details,
                            resultChunks);
+    Py_DECREF(resultChunks);
   } else {
     result = Py_BuildValue("(OiO)",
                            isReliable ? Py_True : Py_False,

Something like this will show the memory growth pretty quickly:

import cld2

for i in xrange(1000000):
    x=cld2.detect("Now is the time for all good men to come to the aid of their country", hintLanguage="en", isPlainText=True, returnVectors=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant