macperl-toolbox-digest Friday, April 2 1999 Volume 01 : Number 008 [MacPerl-Toolbox] Memory leak Re: [MacPerl-Toolbox] Memory leak ---------------------------------------------------------------------- Date: Wed, 31 Mar 1999 16:52:08 -0500 From: kpreid@ibm.net (Kevin Reid) Subject: [MacPerl-Toolbox] Memory leak Why does this eat memory? #!perl -w use Mac::QuickDraw; $col = new RGBColor (0,0,0); for (;;) { $col->red($col->red + 1); } - -- Kevin Reid: | Macintosh: "I'm me." | Think different. ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-toolbox-request@macperl.org ------------------------------ Date: Fri, 2 Apr 1999 10:00:36 +0100 From: ajf@afco.demon.co.uk (Alan Fry) Subject: Re: [MacPerl-Toolbox] Memory leak Kevin Reid writes 31 Mar 1999 16:52:08 -0500 >Why does this eat memory? > >#!perl -w > >use Mac::QuickDraw; > >$col = new RGBColor (0,0,0); >for (;;) { > $col->red($col->red + 1); >} I agree it does eat memory and I have no idea why it should do, though it must be said an endless loop like that is a pretty severe test :) Repeating 4 times 1000 operations of $col->red($col->red+1) in succession resulted in the following figures for pointer space and handle space used up: pointers | handles ----------------|--------------- 1900144 | 116672 after RGBColor->new() 1965712 | 116992 after 1000 operations 1998496 | 116992 after 2000 operations 2064064 | 117008 after 3000 operations 2096848 | 117008 after 4000 operations For every 1000 runs either 2**15 + 16 K or 2**16 + 32 K of pointer space was consumed. I don't know if this sheds any light on what is going on. I have some evidence also that PtInRect() and PtInRgn() also consume pointer space. The problem shows up with any window which is continously busy handling clicks (a text editor for instance) throughout the life of the script. Alan Fry ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-toolbox-request@macperl.org ------------------------------ End of macperl-toolbox-digest V1 #8 *********************************** ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" ==== to macperl-toolbox-digest-request@macperl.org