--- Caleb Tennis wrote: > Ok, I've updated to the latest changes in the 3.5 branch of the > qtruby/korundum and ran my program through valgrind for about 24 > hours to > accumulate where the leaks are still coming from. Here are the two > big > offenders: > > [charP marshaller leaks] > I can definitely see HOW the memory is being leaked, but it's not > entirely > clear where the responsibility lies for cleaning up the heap objects > after > they are created. I may just stab at it for a while unless you have > any > thoughts, Richard? In the latest Qt4 version, the m->cleanup() logic has been commented out. Is there a reason? Smoke has delete-responsibility information built in, for argument/return-values. Here's the charP marshaller from PerlQt, for comparison: switch(m->action()) { case Marshall::FromSV: { SV *sv = m->var(); if(!SvOK(sv)) { m->item().s_voidp = 0; break; } if(m->cleanup()) m->item().s_voidp = SvPV_nolen(sv); else { STRLEN len; char *svstr = SvPV(sv, len); char *str = new char [len + 1]; strncpy(str, svstr, len); str[len] = 0; m->item().s_voidp = str; } } break; case Marshall::ToSV: { char *p = (char*)m->item().s_voidp; if(p) sv_setpv_mg(m->var(), p); else sv_setsv_mg(m->var(), &PL_sv_undef); if(m->cleanup()) delete[] p; } break; default: m->unsupported(); break; } If you'll notice, it's checking m->cleanup() on both the To and From marshallers. In the From marshaller, m->cleanup() indicates that the CALLEE will destroy the passed-in value -- in that case, I make a copy of my string before passing it through. In the To marshaller, m->cleanup() indicates that the contents were copied automatically *inside the Smoke library* before being passed to the marshaller. As soon as you copy the string into a language variable, it's your responsibility to delete it. This happens most often with objects (such as a function returning 'const QSize&') which are copied via new inside Smoke, where it's your responsibility to destroy the object. That's my knowledge in the matter. I don't know how much it applies to QtRuby these days. :) Good luck, - Ashley Winters __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ Kde-bindings mailing list Kde-bindings@kde.org https://mail.kde.org/mailman/listinfo/kde-bindings