[Kde-perl] Request for patches; Re: Massive PerlQt memory leakage
Ole Christensen
Ole.Christensen at web.de
Tue Jul 5 19:26:13 CEST 2005
Ashley,
yes! Here is my private collection.
1. Fix for problem with overloading Qt::ToolTip::maybeTip
=========================================================
I got this patch from Richard Dale. This is his corresponding comment:
* If a class doesn't have a virtual destructor, then no mapping was being
kept from the C++ instance to the corresponding ruby value. If the class
had virtual method callbacks, this meant that the ruby instance couldn't
be found, and the callback couldn't be made.
* Hence, the Qt::ToolTip callback in examples/qt-examples/tooltip didn't
work, as that class doesn't have a virtual destructor.
--- snip ---
*** old/Qt.xs 2004-10-30 10:11:42.741808984 +0200
--- new/Qt.xs 2004-10-30 10:20:17.961483688 +0200
***************
*** 1822,1830 ****
if(!o)
XSRETURN_EMPTY;
SmokeClass c( o->smoke, o->classId );
! if(!c.hasVirtual() ) {
! XSRETURN_EMPTY;
! }
mapPointer(obj, o, pointer_map, o->classId, 0);
bool
--- 1822,1830 ----
if(!o)
XSRETURN_EMPTY;
SmokeClass c( o->smoke, o->classId );
! # if(!c.hasVirtual() ) {
! # XSRETURN_EMPTY;
! # }
mapPointer(obj, o, pointer_map, o->classId, 0);
bool
--- snip ---
2. Fix for methods returning non-scalar
=======================================
I got this patch from Germain Garand. I think this patch was intended to
go into CVS anyway. Works fine for me.
--- snip ---
Index: Qt.xs
===================================================================
RCS file: /cvsroot/perlqt/PerlQt-3/PerlQt/Qt.xs,v
retrieving revision 1.87
diff -u -3 -p -r1.87 Qt.xs
--- Qt.xs 29 Mar 2004 20:31:31 -0000 1.87
+++ Qt.xs 23 Nov 2004 07:50:55 -0000
@@ -993,17 +993,16 @@ XS(XS_AUTOLOAD) {
sv_this = newSVsv(ST(0));
}
- ENTER;
- SAVETMPS;
PUSHMARK(SP - items + withObject);
PUTBACK;
- int count = call_sv((SV*)GvCV(gv), G_SCALAR|G_EVAL);
+ I32 gimme = GIMME_V;
+ int count = call_sv((SV*)GvCV(gv), gimme|G_EVAL);
SPAGAIN;
- SV *ret = newSVsv(TOPs);
- SP -= count;
- PUTBACK;
- FREETMPS;
- LEAVE;
+ SP -= count;
+ if (withObject) // shift the stack
+ for (int i=0; i<count; i++)
+ ST(i) = ST(i+1);
+ PUTBACK;
if(withObject && !isSuper) {
SvREFCNT_dec(sv_this);
@@ -1014,8 +1013,10 @@ XS(XS_AUTOLOAD) {
if(SvTRUE(ERRSV))
croak(SvPV_nolen(ERRSV));
- ST(0) = sv_2mortal(ret);
- XSRETURN(1);
+ if (gimme == G_VOID)
+ XSRETURN_UNDEF;
+ else
+ XSRETURN(count);
}
else if(!strcmp(method, "DESTROY")) {
SV *old_this;
--- snip ---
Mail traffic for both problems is on the list's archive: Oct/Nov 2004.
Thanx for your effort. PerlQt is worth the trouble!
Regards,
Ole.
Ashley Winters wrote:
> Agreed. Are there any other patches which need applying before a
> minimal bugfix release?
>
> Ashley
>
> --- Gary Greene <greeneg at phoenuxos.com> wrote:
>
>
>>On Tuesday 05 July 2005 06:00 am, Marius Kjeldahl wrote:
>>
>>>Gary Greene wrote:
>>>
>>>>I can confirm this as Germain sent me a patch for it a little
>>
>>over a year
>>
>>>>ago when I packaged it for another distribution. The patch is
>>
>>attached.
>>
>>>>
>>>>
>>>>
> ------------------------------------------------------------------------
>
>>>>--- PerlQt/Qt.xs~ 2004-06-01 10:12:35.000000000 +0100
>>>>+++ PerlQt/Qt.xs 2004-06-01 10:12:35.000000000 +0100
>>>>@@ -152,6 +152,7 @@
>>>> SvREFCNT_dec(keysv);
>>>> return 0;
>>>> }
>>>>+ SvREFCNT_dec(keysv);
>>>> return *svp;
>>>> }
>>>
>>>Patch looks golden and seems to solve memory leakage at my end. I
>>
>>would
>>
>>>suggest somebody with a clue puts out a new release with it
>>
>>included, to
>>
>>>save others from struggling with leakage as we had to go through.
>>>Hopefully, Google will also pick this up. Not sure why I never
>>
>>found any
>>
>>>references to it when I tried (and I searched a lot).
>>>
>>>Thanks,
>>>
>>>Marius K.
>>>_______________________________________________
>>>Kde-perl mailing list
>>>Kde-perl at kde.org
>>>https://mail.kde.org/mailman/listinfo/kde-perl
>>
>>Agreed, this should warrant at least a 3.0009 at least.
>>
>>--
>>Gary L. Greene, Jr.
>>Sent from uriel.tolharadys.net
>> 07:22:26 up 11:47, 3 users, load average: 0.34, 0.41, 0.45
>>
>>============================================================
>>Developer and Project Lead for PhoeNUX OS.
>> check out http://www.phoenuxos.com/ for more info.
>>EMAIL : greeneg at phoenuxos.com
>>============================================================
>>
>>
>>>_______________________________________________
>>
>>Kde-perl mailing list
>>Kde-perl at kde.org
>>https://mail.kde.org/mailman/listinfo/kde-perl
>>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> _______________________________________________
> Kde-perl mailing list
> Kde-perl at kde.org
> https://mail.kde.org/mailman/listinfo/kde-perl
More information about the Kde-perl
mailing list