Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!convex!usenet From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.lang.perl Subject: Re: passing by reference Message-ID: <1991Jun20.123343.11872@convex.com> Date: 20 Jun 91 12:33:43 GMT References: <81@sbi.sbi.com> Sender: usenet@convex.com (news access account) Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 22 Nntp-Posting-Host: pixel.convex.com From the keyboard of alan@sbi.sbi.com (Alan Zeigler): >while ($i++ < 1000000) { > foreach ('foo', 'bar') { > *FILEHANDLE = &heap_new('filehandle_heap'); I'm not entirely surprised you're getting a leak here. From the man page: Assignment to *name is currently recommended only inside a local(). You can actually assign to *name anywhere, but the previous referent of *name may be stranded forever. This may or may not bother you. I suspect that's what happening to you. Of course, if you say local(*FILEHANDLE) in your loop, you'll still get 1000000 versions pushed on the stack, which I'd call sub-optimal. --tom -- Tom Christiansen tchrist@convex.com convex!tchrist "So much mail, so little time."