Hi Krzysztof,
I finally got the two easy memory leak patches into my code (three binbuf_free() calls.) The one about the "subcanvas" object will go away when I make a big change (which I'm trying to put off until after 0.34). The change is to make the "canvas" and "subcanvas" objects the same thing, which should make several things simpler.
During testing I also found a few memory leaks. One -- the leaking of local binbuf in save routine -- could partly explain the save-close-open-crash mystery reported by Gregorio GarcĂa and Greg Rippin. This leakage can be quite large, depending on currently saved patch size. It is also very easy to stop -- canvas_saveto() of g_canvas.c is lacking a closing call of
}binbuf_free(b);
There is also a very small (18 bytes) leak which happens every time any window is closed. The two binbufs: t_editor::e_connectbuf and t_editor::e_deleted should be freed in editor_free() of g_canvas.c:
- binbuf_free(x->e_connectbuf);
- binbuf_free(x->e_deleted); freebytes((void *)x, sizeof(*x));
Finally there is a small (40-byte) memory amount leaking every time toplevel patch is closed. It is due to not freeing memory allocated to parent `container' object in canvas_new():
t_subcanvas *y = (t_subcanvas *)pd_new(subcanvas_class);
This is small, infrequent, and probably not worth the fuss, although there could be some danger of future bugs lurking here...