_____
From: Ivica Ico Bukvic [mailto:ico@vt.edu] Sent: Tuesday, December 13, 2011 4:18 AM To: Hans-Christoph Steiner; Jonathan Wilkes; Krzysztof Czaja; pd-dev Subject: Re: [PD-dev] deadly leak
This problem has a series of fixes spread all across the code. It is not one instance but literally dozens. Just when I thought I had them all I found one last lingering one just a couple of weeks ago. That said I think pd-l2ork's implementation is now rock solid with all its redraw issues and quirks fixed.
Well, as usual, I spoke too soon. Now that the infinite undo is nearing its full implementation, I have tripped over this bug again even though it has been gone for almost a year of thorough testing. The problem arises when a canvas is created (so far tested only with an abstraction--the larger it is, the more likely the bug is to surface), then cut, and then undo cut, sometimes it is recreated in the same memory location as the previous one. (e.g. do a gop object that in its visible part has loadbang->window_name->symbol). Several cuts and undos will eventually recreate the object in new memory space and the problem will temporarily disappear. OTOH, as long as it is recreating in the same memory space, entry bug becomes double entry, then triple entry, etc. The crash occurs when one asks for double (triple, quadruple. etc.) free when deleting an object or doing anything like it destructive that has danger of tripping over pointers that have been already freed.
At one point Mathieu suggested that unbinding is not doing its job properly but according to my preliminary debugging of pd_unbind calls (if that is what unbinds things with the canvas or is it?) it seems to be calling it ok for each canvas and subcanvas and yet everything is getting bound multiple times to a canvas. One potentially crazy explanation would be that with larger memory allocation chunks perhaps OS is trying to find best location and if it is identical to one that has just been freed, it puts it there and hence the symptom. Although this still does not explain why unbind does not unbind key presses/mouse clicks etc.
Any ideas?