On Sat, 2005-04-23 at 10:48 +0300, Nikita Savin wrote:
> > Can you confirm?
> 
> Yes, no memory leak with Epoll::one_event()

OK, this is strange.  I am passing G_VOID into a Perl_call_* function
and it's returning *1* instead of zero, which seems to be contrary to
the perlcall man page.  (near ev.c:307)

Does the attached patch work for you?

-- 
If you are an American then support http://fairtax.org
 (Permanently replace 50,000+ pages of tax law with about 200 pages.)
*** ./c/ev.c    Wed Dec  8 04:32:23 2004
--- ./c/ev.c    Sat Apr 23 21:18:03 2005
***************
*** 299,320 ****
      if (EvPERLCB(ev)) {
        SV *cb = SvRV((SV*)ev->callback);
        int pcflags = G_VOID | (SvIVX(Eval)? G_EVAL : 0);
!       dSP;
        SV *evsv = event_2sv(ev);
        if (SvTYPE(cb) == SVt_PVCV) {
-           PUSHMARK(SP);
            XPUSHs(evsv);
            PUTBACK;
!           perl_call_sv((SV*) ev->callback, pcflags);
        } else {
            AV *av = (AV*)cb;
            assert(SvTYPE(cb) == SVt_PVAV);
-           PUSHMARK(SP);
            XPUSHs(*av_fetch(av, 0, 0));
            XPUSHs(evsv);
            PUTBACK;
!           perl_call_method(SvPV(*av_fetch(av, 1, 0),n_a), pcflags);
        }
        if (SvTRUE(ERRSV)) {
            if (pcflags & G_EVAL)
                pe_callback_died(frp);
--- 299,323 ----
      if (EvPERLCB(ev)) {
        SV *cb = SvRV((SV*)ev->callback);
        int pcflags = G_VOID | (SvIVX(Eval)? G_EVAL : 0);
!       int retcnt;
        SV *evsv = event_2sv(ev);
+       dSP;
+       PUSHMARK(SP);
        if (SvTYPE(cb) == SVt_PVCV) {
            XPUSHs(evsv);
            PUTBACK;
!           retcnt = perl_call_sv((SV*) ev->callback, pcflags);
        } else {
            AV *av = (AV*)cb;
            assert(SvTYPE(cb) == SVt_PVAV);
            XPUSHs(*av_fetch(av, 0, 0));
            XPUSHs(evsv);
            PUTBACK;
!           retcnt = perl_call_method(SvPV(*av_fetch(av, 1, 0),n_a), pcflags);
        }
+       SPAGAIN;
+       SP -= retcnt;
+       PUTBACK;
        if (SvTRUE(ERRSV)) {
            if (pcflags & G_EVAL)
                pe_callback_died(frp);

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to