Change 16041 by sky@sky-lab on 2002/04/21 13:53:54

        Got the last memory leak in the while(1) { threads->create(sub 
        {})->join() }, now we can loop over a million threads without a 
        problem. 
        Cleared up SVs that should have been mortal but never where.

Affected files ...

.... //depot/perl/ext/threads/threads.xs#37 edit

Differences ...

==== //depot/perl/ext/threads/threads.xs#37 (xtext) ====
Index: perl/ext/threads/threads.xs
--- perl/ext/threads/threads.xs.~1~     Sun Apr 21 08:00:05 2002
+++ perl/ext/threads/threads.xs Sun Apr 21 08:00:05 2002
@@ -439,6 +439,7 @@
        known_threads++;
        active_threads++;
        MUTEX_UNLOCK(&create_destruct_mutex);
+       sv_2mortal(params);
        return ithread_to_SV(aTHX_ obj, thread, classname, FALSE);
 }
 
@@ -541,7 +542,7 @@
     if (items > 2) {
        int i;
        for(i = 2; i < items ; i++) {
-           av_push(params, ST(i));
+           av_push(params, SvREFCNT_inc(ST(i)));
        }
     }
     ST(0) = sv_2mortal(Perl_ithread_create(aTHX_ Nullsv, classname, function_to_call, 
newRV_noinc((SV*) params)));
End of Patch.

Reply via email to