-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Reference leaks (Trac #562) #1160
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
Comments
trac user langner wrote on 2007-10-28 Another memory leaks has been found, although possibly not the same: |
trac user langner wrote on 2007-10-28 This is something different, so I opened a separate ticket (#1200). |
trac user matthieu.brucher wrote on 2008-03-19 Running the debug python, I noticed that :
leaks references as well, so it may not be related to copies at all. |
Attachment added by trac user matthieu.brucher on 2008-03-19: patch-562 |
trac user matthieu.brucher wrote on 2008-03-19 I've attached a patch that does not induce regressions.
|
trac user matthieu.brucher wrote on 2008-03-19 A code to test for the presence of the leak with valgrind (from Lisandro message) :
|
@stefanv wrote on 2008-03-20 Added as r4897. Thank you for tracking this down! |
@teoliphant wrote on 2008-03-21 I don't understand this patch. I don't think it is correct. The PyArray_DESCR() "call" does not increment the reference count. It is just a macro to access the array descriptor object in an ndarray. |
trac user matthieu.brucher wrote on 2008-03-21 Perhaps I missed something as there seems to be some worries about what I've done (#1308), but at least the reference leak error is (I'm 99% sure of that fact by having printed the reference counts of the different objects in this function, but I was wrong once, I could be twice ;)) in the _array_fromobject() function. So perhaps that Travis and/or Paulin should take a look at it to correctly track what is going on. BTW, with the latest SVN, python segfaults with Lisandro's test, which was not the case when I updated the patch. I've added a display of the reference count of oldtype before line 5658 (Py_INCREF(op)) :
It is clear that the reference count IS increasing. BTW, the patch that was applied is not the one I supplied :| |
@stefanv wrote on 2008-03-21 Sorry, I applied the wrong patch. Reverted in r4905. Has anyone had a chance to take a further look? |
trac user matthieu.brucher wrote on 2008-03-21 Thank you stéfan ;) The reference count I showed are made from the multiarray.c file without the faulty patch (adress of the PyObject and its refcnt), so it is what was going on before my fix which is not correct, but which does the job, so the issue is perhaps more convoluted than I thought). |
@teoliphant wrote on 2008-03-22 I've looked over this and finally read what Lisandro reported. He was right in that use of DescrConverter in PyArg_ParseTuple needs to be tracked carefully to be sure and get reference counts correct. I've done this and applied the fix in r4911. Running his original npyleaktest script with a debug build of Python showed no leaks in npy_asarray_2() so I'm closing this ticket. |
Original ticket http://projects.scipy.org/numpy/ticket/562 on 2007-08-03 by @alberts, assigned to unknown.
Lisandro Dalcin reported some possible reference leaks:
http://projects.scipy.org/pipermail/numpy-discussion/2007-August/028749.html
http://projects.scipy.org/pipermail/numpy-discussion/2007-August/028757.html
The text was updated successfully, but these errors were encountered: